import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) /* Layout */ import Layout from '@/layout' /** * constantRoutes * a base page that does not have permission requirements * all roles can be accessed */ export const constantRoutes = [ { path: '/', component: Layout, redirect: '/screen', children: [ { path: 'screen', component: () => import('@/views/screen'), name: 'Screen', meta: { title: '监控大屏', icon: 'dashboard', affix: true } } ] }, // { // path: '/maphydraulic', // component: Layout, // redirect: '/maphydraulic', // children: [ // { // path: 'maphydraulic', // component: () => import('@/views/map/routeMap.vue'), // name: 'Maphydraulic', // meta: { title: '泵设备分布图', icon: 'el-icon-location', affix: true } // } // ] // }, // { // path: '/Wind', // component: Layout, // redirect: '/Wind', // children: [ // { // path: 'Wind', // component: () => import('@/views/device/maintenance'), // name: 'Wind', // meta: { title: '风场管理', icon: 'el-icon-wind-power', affix: true } // } // ] // }, // { // path: '/Maintenance', // component: Layout, // redirect: '/Maintenance', // children: [ // { // path: 'Maintenance', // component: () => import('@/views/device/maintenance'), // name: 'Maintenance', // meta: { title: '维保记录', icon: 'el-icon-coin', affix: true } // } // ] // }, { path: '/login', component: () => import('@/views/login/index'), hidden: true }, { path: '/profile', component: Layout, redirect: '/profile/index', hidden: true, children: [ { path: 'index', component: () => import('@/views/profile/index'), name: '个人信息', meta: { title: '个人信息', icon: 'user', noCache: true } } ] } ] const createRouter = () => new Router({ // mode: 'history', // require service support scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) 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