解决vue组件中插槽为undefined的问题

63

如题,问题就不多描述了,看图

image-eotr.png

原因:vue在2.6.12到2.6.13版本迭代中更改了插槽的render方法,render后的函数参数改变了。导致用较高版本的vue及vue-template-compiler项目build打包后的包,用于vue版本较低的项目中时,插槽解析失败,显示为undefined。

解决方案:要避免此问题,需保证vue及vue-template-compiler版本一致。即:项目所用的vue版本 >= 打包组件所用的vue版本 >= 2.6.13。

参考资料:https://www.cnblogs.com/iPing9/p/16210898.html🔗