1234567891011121314151617181920212223 |
- import Vue from 'vue';
- import VueRouter from 'vue-router';
- import { routes } from './modules/index';
- Vue.use(VueRouter);
- const createRouter = () =>
- new VueRouter({
- mode: 'hash',
- scrollBehavior: () => ({ y: 0 }),
- routes,
- });
- const router = createRouter();
- // 重置路由
- export function resetRouter() {
- const newRouter = createRouter();
- router.matcher = newRouter.matcher;
- }
- export default router;
|