百度都是通过计算属性来hack,其实官方有解决方法,直接看代码:
data() {
return {
query: {
page: 1,
per_page: 10,
status: null,
order_num: null,
order_type: null,
},
};
},
watch: {
'query.order_type'(val, oldV) {
console.log(val, oldV)
this.getData();
},
'query.status'(val,oldV){
this.getData();
}
https://laracasts.com/discuss/channels/vue/watch-returning-same-oldval-and-val
https://vuejs.org/v2/api/#vm-watch