路由重复加载报错的问题

今天接手一个项目,第一次点击栏目没有问题,但是第二次点击,就报错:

 

 

在main.js加入这段代码解决

import VueRouter from "vue-router";
const originalPush = VueRouter.prototype.push;
//location 点击的路由 VueRouter.prototype.push
= function push(location) { return originalPush.call(this, location).catch(err => err) }

 

posted @ 2020-06-19 17:59  云霄紫潭  阅读(272)  评论(0编辑  收藏  举报