vue中watch监听对象的某个属性
第一种 :
c
watch:{
'user.name'(val){
console.log(val)
}
}
第二种(不建议使用,对象有多个属性会一层一层遍历):
c
watch:{
user:{
handle:function(newVal){
console.log(newVal)
},
deep:true,//表示是否深度监听
}
}