vue中watch同时监听多个数据的变化
data(){
return {
fromList: {
custType: "",
Organization: "",
},
btnDisabled: true,
};
},
computed: {
change() {
const { custType, Organization } = this.fromList; //如果直接写在data里,则直接=this
return { custType, Organization };
},
},
watch: {
change: {
handler(newValue) {
if (newValue.custType && newValue.Organization) {
this.btnDisabled = false; //当custType, Organization 都为true的时候,btnDisabled为false
}
},
deep: true,
immediate: true,
},
},
收集项目中遇到问题从中得到解决方法的链接。

浙公网安备 33010602011771号