data: {
datas: {
a: 77,
b: 86
}
}
使用deep:true
深層次監聽
'datas':{
handler:function(newVal){
console.log(this.datas);
},
deep:true
}
監聽某一個具體的屬性
'datas.a':{
handler:function(newVal){
console.log(this.datas);
}
}
使用computed來監聽某一個具體的屬性
watch: {
a(newVal){
console.log(this.datas);
}
},
computed: {
a:function(){
return this.datas.a;
}
}