data() {
return {
form:{
name:"",
},
show:false,
}
}
watch: {
//表单监听
"form.name": {
deep: true,
handler(newVal, oldVal) {
if (newVal) {
this.form.name= "张三";
}
},
},
//常规监听
show: {
deep: true,
// immediate: true,
handler(newVal, oldVal) {
if (newVal === true) {
...
}
},
},
},
解决参考:https://blog.csdn.net/m0_66570642/article/details/132521632