热搜:fiddler git ip 代理 ios
历史搜索

解决Vue前端报错Uncaught (in promise) Error: Navigation cancelled from “/…“ to “/…“ with a new

游客2025-01-06 12:33:03

解决 Vue 前端报错 Uncaught (in promise) Error: Navigation cancelled from “/…“ to “/…“ with a new navigation 问题。

如下图所示:

解决Vue前端报错Uncaught (in promise) Error: Navigation cancelled from “/…“ to “/…“ with a new navigation 1

如何解决该问题,需要在 index.js 文件中添加如下代码:

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
标签:vue