import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) import shop from './modules/shop' /* Layout */ import Layout from '@/layout' /* Router Modules */ export const constantRoutes = [ { path: '/login', component: () => import('@/views/login/index'), hidden: true, }, { path: '/404', component: () => import('@/views/404'), hidden: true, }, { hidden: true, path: '/', redirect: '/shop/shop-manage/site/au', }, { path: '*', redirect: '/404', hidden: true }, ] export const asyncRoutes = [shop] const createRouter = () => new Router({ // mode: 'hash', // require service support scrollBehavior: () => ({ y: 0 }), routes: [...constantRoutes, ...asyncRoutes], }) const router = createRouter() // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 export function resetRouter() { const newRouter = createRouter() router.matcher = newRouter.matcher // reset router } export default router