在main.js文件添加以下代码(代码直接复制就好,无需改动)
import Router from 'vue-router'
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
或者在router中添加同样代码
路由模块拆分
index.js可放公共路由
routerInfo.js 各模块路由