vue深度监听一个对象
深度监听对象的变化data: {obj: {age: 18}},watch: {obj: {handler(newVal, oldVal){},deep: true}}监听对象的某个属性变化data: { obj: { age: 18 }},computed: { isage(){ ret.
·
- 深度监听对象的变化
data: {
obj: {
age: 18
}
},
watch: {
obj: {
handler(newVal, oldVal){
},
deep: true
}
}
- 监听对象的某个属性变化
data: {
obj: {
age: 18
}
},
computed: {
isage(){
return this.obj.age
}
},
watch: {
isage(){
console.log('obj.age发生变化')
}
}
更多推荐
已为社区贡献4条内容
所有评论(0)