[Vue warn]: 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: "filterStatus"

这个报错的意思是子组件修改了父组件传来的值。
原因:父组件可以有很多的子组件,如果每一个子组件都可以去修改父组件的值,那可能就会引起冲突,但是如果需求中就要改变这个值怎么办呢?
解决:可以在子组件的data里写一个另外的值,用这个值来接收传递过来的值,这样一来这个值变化就不会有错了。
data: function() {
return { filterStatus1: this.filterStatus }
},
5万+

被折叠的 条评论
为什么被折叠?



