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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM