index.js 424 B

1234567891011121314151617181920212223
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. import { routes } from './modules/index';
  4. Vue.use(VueRouter);
  5. const createRouter = () =>
  6. new VueRouter({
  7. mode: 'hash',
  8. scrollBehavior: () => ({ y: 0 }),
  9. routes,
  10. });
  11. const router = createRouter();
  12. // 重置路由
  13. export function resetRouter() {
  14. const newRouter = createRouter();
  15. router.matcher = newRouter.matcher;
  16. }
  17. export default router;