1.监听路由处理html
watch: { $route(to, from) { // 逻辑
// 从新调用数据接口
} },
2.beforeRouteUpdate导航守卫 路由更新时触发
vue
beforeRouteUpdate (to, from, next) { // 逻辑 this.$route.query.xx = to.params.xx; next() // 必定要有next },
3.只须要在入口文件设置监听事件便可app
<div id="app" :key="Key">
</div> data() { return { Key: '' }; }, watch: { $route: function(newUrl, oldUrl) { this.Key = new Date().getTime(); } }