1. 页面监听路由
watch: {
'$route' (to, from) {
this.categoryId = this.$route.query.categoryId
this.tagId = this.$route.query.tagId
}
}
2. 组件也要监听
watch: {
'$route' (to, from) {
this.getArticle(this.articleId)
console.log('监听路由')
}
}
参考文章
Vue 跳转相同路由不同参数,解决页面数据不自动刷新