### vue2.6.1 使用watch深度监听
data(){search: { key: "", page: 1} },
created() { this.search.page = 1;},
methods:{
changePage(i) { this.search.page = this.index(i) },
//按钮点击事件
prePage(){ if (this.search.page > 1) {
//预期触发watch的操作
this.search.page = this.search.page - 1;
}},
index(i) { //doing some thing to return a val
},
searchData() { //doing somethind for seaching data
},
},
watch: { search: {
deep: true,
handler(){
this.searchData()
}
}
}