在自己写的子组件中加了可以[v-model]的绑定功能,在父组件中使用,出现下面问题:
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: “value”
found in
避免直接改变属性值,因为每当父组件重新渲染时,该值都将被覆盖。相反,请使用基于属性值的数据或计算属性。"value"属性值正在被改变
检查到修改"value"属性值的代码
setSelectValue () {
this.selectValue = this.selectValueAll[this.selectValueAll.length - 1]
this.value = this.selectValue
this.$emit('input', this.value)
}
修改
this.selectValue = this.selectValueAll[this.selectValueAll.length - 1]
// 不直接改变属性值
this.$emit('input', this.selectValue)
}