今天在开发过程中偶然返现这个小问题:watch监听父组件传过来的值并给el-input赋值 之后发现无法修改input得值 需要在input里添加 @input="change($event)"
<el-input v-model="condition.name" @input="change($event)" size="small" clearable></el-input>
watch里赋值
chemicalName: {
handler (value) {
this.condition.name = value
this.onSearch()
},
deep: true
}
然后在methods里写上以下方法就ok了
change () {
this.$forceUpdate()
},