其他分享
首页 > 其他分享> > ElementUI之日期组件el-date-picker控制台报错的处理记录

ElementUI之日期组件el-date-picker控制台报错的处理记录

作者:互联网

在引用了el-date-picker组件后,控制台一直报错

Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "placement"

多次检查代码后发现props接收的对象中压根没有"placement"属性,开启了百度节奏,但一直都是按照props被更改的问题进行检索的,实际上从这步开始就已经偏离轨道了。

接着又认真仔细的观察了控制台的报错语句,问题一直指向的是picker组件,于是更改了搜索关键词【el-date-picker报错改变了props的值】,终于找到问题了。

这篇博文 https://blog.csdn.net/weixin_44719703/article/details/125769178 明确的指出安装的element-ui版本有问题。

随后检查项目中的package.json文件,发现此文件中的element-ui版本是element-ui@2.12.0,如此一来问题就对不上了。排查了一遍后,在package-lock.json中发现对应的element-ui的version: '2.15.9',至此就破案了。

将element-ui降版安装就可以了,具体版本自行选择。

npm install element-ui@2.15.5 --save

标签:picker,el,element,ui,props,报错
来源: https://www.cnblogs.com/min77/p/16553495.html