?解決導(dǎo)航問題
解決VUE路由跳轉(zhuǎn)出現(xiàn)Redirected when going from "/xxx" to "/yyy" via a navigation guard.報錯
JavaScript天下第一關(guān)注
0.0682020.08.07 10:05:20字數(shù) 95閱讀 228
解決方式:
1.對vue-router降低版本到3.0.7,手動修改就行了

21388354-0ae67c66cee522bf.png

21388354-8992e94846dfe588.png
修改完之后記得刪除原來的node_modules文件,再使用npm i 或yarn install生成新node_modules文件
2.第一種不行的小伙伴可以使用第二種,直接復(fù)制下面代碼到router文件下index.js,也是可以解決的
constoriginalPush=VueRouter.prototype.pushVueRouter.prototype.push=functionpush(location,onResolve,onReject){if(onResolve||onReject)returnoriginalPush.call(this,location,onResolve,onReject)returnoriginalPush.call(this,location).catch(err=>err)