vue报错 [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

[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: 'mode'

这个错误是我在子组件里操作父组件传过来的值时报的错,看了官方文档说要保证父子组件单向数据流,子组件不允许修改父组件的值,但是数组对象可以

如果要修改可以通过$emit触发父组件里的方法去修改

如果你只是在子组件里体现,可以用个新的key去接收然后再修改新的key

上一篇:java实现一个简单的爬虫小程序


下一篇:VUE - vue.runtime.esm.js?6e6d:619 [Vue warn]: Do not use built-in or reserved HTML elements as component i