站长图库向大家介绍了vue.js,路由,跳转页面,不刷新怎么办等相关知识,希望对您有所帮助
vue.js路由this.route.push跳转页面不刷新的解决办法:使用【activated:{}】周期函数代替【mounted:{}】函数,代码为【this.$router.go(0);】。
vue.js路由this.route.push跳转页面不刷新的解决办法:
1、使用activated:{}周期函数代替mounted:{}函数即可。
2、监听路由
// 不推荐、用户体验不好watch: { '$route' (to, from) { // 路由发生变化页面刷新 this.$router.go(0); }},// 该方法会多一次请求watch: { '$route' (to, from) { // 在mounted函数执行的方法,放到该处 this.qBankId = globalVariable.questionBankId; this.qBankName = globalVariable.questionBankTitle; this.searchCharpter(); }},