Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-

mac2024-07-25  51

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: “heighest”

原因:在子组件中修改了父组件的传值

解决方法: 在子组件中用一个新的变量去接收父组件的传值例如:

props:{ heighest:{ type: String, default: '' } }, data:{ heightPrice: this.heighest }
最新回复(0)