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

Created on 9 Jun 2020  ·  1Comment  ·  Source: PanJiaChen/vue-element-admin

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)

Most helpful comment

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

>All comments

这个是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)
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

343512292 picture 343512292  ·  3Comments

cqzongjian picture cqzongjian  ·  4Comments

nacimgoura picture nacimgoura  ·  3Comments

sunchenguang picture sunchenguang  ·  4Comments

gateslu picture gateslu  ·  4Comments