1.watch监听obj中的某一个属性
使用计算属性computed
data(){
return {
searchData: {
searchKey: ""
}
}
},
computed:{
searchKey(){
return this.searchData.searchKey
}
},
watch:{
searchKey(n,o){
if(n){
//do something
}
}
}