当仅仅改变路由参数时,mounted不会跟踪路由变化,这里可以用watch动态监视路由的细微变化
mounted() {
this.searchData.keyword = this.$route.query.keyword;
this.searchAll();
},
//解决同一路由不同参数页面无法刷新的问题
watch: {
$route(to,from){
this.searchData.keyword = this.$route.query.keyword;
this.searchAll();
}
},