Print

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


作者: 文章来源:

本文原地址:https://www.mimiwuqi.com/webqianduan/196367.html

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

更多 建站教程 请访问 https://www.mimiwuqi.com/webqianduan/