vue中的错误提示

1. 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: "content" found in
避免直接修改道具,因为当父组件重新呈现时,值将被覆盖。相反,使用基于道具值的数据或计算属性。道具突变:“内容”在里面

 原因:子组件中接收到父组件传入的值,直接对该值进行修改,vue中传值是单向流的,不允许子组件对父组件的值进行修改,这样防止造成不必要的麻烦

解决:对父组件传入的值,子组件进行clone使用

父组件传入的是content值,子组件通过data函数,将content值赋值给name,这样就可以对name进行修改操作了。

猜你喜欢

转载自blog.csdn.net/zyz00000000/article/details/84101356
今日推荐