Home  >  Article  >  Web Front-end  >  What to do if vue.js route this.route.push jump page does not refresh

What to do if vue.js route this.route.push jump page does not refresh

coldplay.xixi
coldplay.xixiOriginal
2020-11-12 11:23:423420browse

The solution to the problem that the vue.js route this.route.push jump page does not refresh: Use the [activated:{}] periodic function instead of the [mounted:{}] function, the code is [this.$router. go(0);].

What to do if vue.js route this.route.push jump page does not refresh

【Related article recommendations: vue.js

vue.js routingthis Solution to .route.push jump page not refreshing:

1. Use the activated:{} periodic function instead of the mounted:{} function. Can.

2. Monitor routing

// 不推荐、用户体验不好
watch: {
'$route' (to, from) {
    // 路由发生变化页面刷新
this.$router.go(0);
}
},
// 该方法会多一次请求
watch: {
'$route' (to, from) {
    // 在mounted函数执行的方法,放到该处
this.qBankId = globalVariable.questionBankId;
this.qBankName = globalVariable.questionBankTitle;
this.searchCharpter();
}
},

Related free learning recommendations: JavaScript (video)

The above is the detailed content of What to do if vue.js route this.route.push jump page does not refresh. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn