Преглед изворни кода

ignore NavigationDuplicated error

Michael Wang пре 5 година
родитељ
комит
1c89af5c16
1 измењених фајлова са 13 додато и 0 уклоњено
  1. 13 0
      src/router.js

+ 13 - 0
src/router.js

@@ -10,6 +10,19 @@ import PrintRoutes from "./modules/print/routes/routes";
 import ReportsRoutes from "./modules/reports/routes/routes";
 import { CORE_API } from "@/constants/constants.js";
 
+// ignore NavigationDuplicated. https://github.com/vuejs/vue-router/issues/2881
+const originalPush = Router.prototype.push;
+Router.prototype.push = function push(location, onResolve, onReject) {
+  if (onResolve || onReject)
+    return originalPush.call(this, location, onResolve, onReject);
+  try {
+    return originalPush.call(this, location).catch(err => err);
+  } catch (error) {
+    console.log(error);
+  }
+};
+// end ignore
+
 Vue.use(Router);
 
 let router = new Router({