下午做了个路由跳转的功能,连续点击跳转两次,出现报红,但是不影响使用。看着蓝瘦。
访问两次相同路由地址报错
解决的办法
在router文件夹下的index.js中加入如下代码,错误消失
import Vue from 'vue'import VueRouter from 'vue-router'
const originalPush = VueRouter.prototype.pushVueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err)}