vue项目在点击重复路由时报错(NavigationDuplicated: Avoided redundant navigation to current location)
如图
解决:在router下的index.js中加以下代码
import Vue from 'vue' import VueRouter from 'vue-router' import ConfigRouters from './modules'; Vue.use(VueRouter) // 修复vue项目在点击重复路由时报错 const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) } let routes = [] routes = routes.concat(ConfigRouters); const router = new VueRouter({ mode: 'history', routes }) export default router