PanJiaChen / vue-element-admin

:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
MIT License
87.99k stars 30.47k forks source link

请问:我在更新了vue-router到最新版后,地址跳转后报这个错 #3243

Open ReturnVwp opened 4 years ago

ReturnVwp commented 4 years ago

Uncaught (in promise) Error: Redirected from "/login?redirect=%2Fsystem%2Fuser" to "/index" via a navigation guard. at createRouterError (vue-router.esm.js?8c4f:2060) at createNavigationRedirectedError (vue-router.esm.js?8c4f:2024) at eval (vue-router.esm.js?8c4f:2226) at eval (permission.js?223d:43)

swvv commented 4 years ago

这个是vue-router报的错,在升级了Vue-Router版本到到3.1.0及以上之后,页面在跳转路由时控制台会报Uncaught (in promise)的问题

具体什么原因导致,看一下Vue-Router的版本日志就知道了 不想报错的话

import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}