[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: "result" (found in component )
vue不推荐直接在子组件中修改父组件传来的props的值,会报错
子组件
props:['demo'],
data(){ return { currentDemo: this.demo //通过data, 定义新变量currentDemo, 这样currentDemo的值变更时,不会影响父组件传来的demo的值 } },
版权声明:本文为lsg_lsg_lsg原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。