百度都是通过计算属性来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://i-blog.csdnimg.cn/blog_migrate/da3f54f134fd3c6995af04bc17d3b764.png)
image.png
https://laracasts.com/discuss/channels/vue/watch-returning-same-oldval-and-valhttps://vuejs.org/v2/api/#vm-watch