vue.js路由this.route.push跳轉(zhuǎn)頁面不刷新的解決辦法:使用【activated:{}】周期函數(shù)代替【mounted:{}】函數(shù),代碼為【this.$router.go(0);】。
vue.js路由this.route.push跳轉(zhuǎn)頁面不刷新的解決辦法:
1、使用activated:{}周期函數(shù)代替mounted:{}函數(shù)即可。
2、監(jiān)聽路由
// 不推薦、用戶體驗不好 watch: { '$route' (to, from) { // 路由發(fā)生變化頁面刷新 this.$router.go(0); } }, // 該方法會多一次請求 watch: { '$route' (to, from) { // 在mounted函數(shù)執(zhí)行的方法,放到該處 this.qBankId = globalVariable.questionBankId; this.qBankName = globalVariable.questionBankTitle; this.searchCharpter(); } },