在router》index.js文件中,添加以下代码:
import VueRouter from 'vue-router'
Vue.use(Router)
// 【添加代码】解决vue-router在3.0版本以上重复点路由报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
解决vue-router在3.0版本以上重复点路由报错