Home > Web Front-end > Vue.js > body text

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

coldplay.xixi
Release: 2020-11-12 11:23:42
Original
3498 people have browsed it

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();
}
},
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template