【vue】warning:Avoid mutating a prop directly
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”
某天,发现项目中某个页面一直有这个warning,代码不是我写的,我也就不管了,如今忍不了了,好奇新驱使我研究一下这个warning。
这只是个警告,代码没有问题,element-ui组件也是按照官方介绍一模一样使用的。
那就只能是element-ui自身的问题了。
解决方式:
更换element-ui版本。
有问题版本:
“element-ui”: “^2.15.9”
更换为:
“element-ui”: “^2.15.14”