【vue router】多次重定向到一个路由报错问题处理
2022-04-05 本文已影响0人
辣子_
// 处理token验证失败,自动登录登录失败,多次重定向到 /loginc 报错问题处理
const originalPush = VueRouter.prototype.push
// 重写了原型上的push方法,统一的处理了错误信息
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}