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

mitkmikd  于 22天前  发布在  其他
关注(0)|答案(1)|浏览(16)

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)

t2a7ltrp

t2a7ltrp1#

这个是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)
}

相关问题