Avoid mutating a prop directly since the value will be overwritten whenever the paren
[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the paren
在vue2.0中子组件触发改变值的时候vue组件会报出例如:
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: "showStaffList"的错误。
原因:
简单的说就是,组件内不能修改props的值
解决方法:
在data中创建一个props值得副本,所有操作props值得地方都通过操作data中副本来实现,比如
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
