| | |
| | | import Vue from 'vue' |
| | | import VueRouter from 'vue-router' |
| | | import PageRouter from './page/' |
| | | import ViewsRouter from './views/' |
| | | import ShowRouter from './show/index' |
| | | import padRouter from './pad/index' |
| | | import AvueRouter from './avue-router' |
| | | import Store from '../store/' |
| | | Vue.use(VueRouter) |
| | | //创建路由 |
| | | export const createRouter = () => new VueRouter({ |
| | | routes: [ ...ViewsRouter,...ShowRouter, ...padRouter] |
| | | routes: [ ...padRouter] |
| | | }) |
| | | |
| | | const Router = createRouter() |
| | |
| | | const originalPush = VueRouter.prototype.push |
| | | const originalReplace = VueRouter.prototype.replace |
| | | //push |
| | | VueRouter.prototype.push = function push(location, onResolve, onReject) { |
| | | /*VueRouter.prototype.push = function push(location, onResolve, onReject) { |
| | | if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) |
| | | return originalPush.call(this, location).catch(err => err) |
| | | } |
| | | }*/ |
| | | //replace |
| | | VueRouter.prototype.replace = function push(location, onResolve, onReject) { |
| | | if (onResolve || onReject) return originalReplace.call(this, location, onResolve, onReject) |