子组件修改props传来得值报错

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: "show"

prop 是单向绑定的:当父组件的属性变化时,将传导给子组件,但是不会反过来。这是为了防止子组件无意修改了父组件的状态——这会让应用的数据流难以理解。

是因为子组件修改了父组件用props 传过来的值,解决办法: 使用vuex进行数据的管理

posted @ 2021-01-05 11:42  秋叶哈哈宋梦辉  阅读(349)  评论(0编辑  收藏  举报