vue项目报错:
Uncaught (in promise) Error: Redirected when going from “/login?redirect=%2Fdashboard” to “/dashboard” via a navigation guard.

解决办法

在router文件下的index.js中添加下面的代码

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);
};

如果本文对你有帮助,请点个赞吧!

Logo

前往低代码交流专区

更多推荐