在计算属性中找到全局定义的值(也是要计算的)
computed: {
// 计算添加终端
billings () {
let sms_num = this.sms_num
return {
sms_num,
}
},
},
使用watch监听computed中的billings
watch: {
// 监听添加短信数量
billings: {
handler (newValue, oldValue) {
if (newValue.sms_num) {
this.POLfun(newValue, oldValue)
}
},
deep: true
},
},
结尾
methods: {
POLfun (newValue, oldValue){
// 代码块
}
}