| | |
| | | Vue.config.productionTip = false |
| | | |
| | | Vue.use(ElementUI, { size: 'small' }) |
| | | Vue.prototype.$cancels = [] |
| | | // 注册指令 |
| | | // registerDirectives(Vue) |
| | | |
| | |
| | | mode: routeMode || 'hash', |
| | | routes: routes |
| | | }) |
| | | |
| | | router.beforeEach((to, from, next) => { |
| | | Vue.prototype.$cancels.forEach((cancel) => { |
| | | cancel() |
| | | }) |
| | | Vue.prototype.$cancels = [] |
| | | // 不需要登录认证的路由 |
| | | if (Object.hasOwnProperty.call(to.meta, 'noLoginIdentify') && to.meta.noLoginIdentify) { |
| | | next() |
| | | return |
| | | } |
| | | next() |
| | | }) |
| | | router.beforeResolve((to, from, next) => { |
| | | next() |
| | | }) |
| | | router.afterEach((to, from) => { |
| | | }) |
| | | export default router |
New file |
| | |
| | | /** |
| | | * meta可配置的参数: |
| | | * meta: { |
| | | * title: { String } 显示在侧边栏、面包屑和标签栏的文字 |
| | | * hideBread: (false) 设为true后此级路由将不会出现在面包屑中 |
| | | * hideMenu: (false) 设为true后在左侧菜单不会显示该页面选项 |
| | | * notCache: (false) 设为true后页面在切换标签后不会缓存,如果需要缓存,无需设置这个字段,而且需要设置页面组件name属性和路由配置的name一致 |
| | | * access: (null) 可访问该页面的权限数组,当前路由设置的权限会影响子路由 |
| | | * } |
| | | */ |
| | | const MapTemplate = (r) => require.ensure([], () => r(require('../views/MapTemplate')), 'frame') |
| | | // const MapHomeMapTalks = r => require.ensure([], () => r(require('../views/map/MapHome-maptalks')), 'web') |
| | | const routes = [ |
| | | { path: '/mapTemplate', name: 'MapTemplate', meta: { statusBgc: 0 }, component: MapTemplate } |
| | | ] |
| | | |
| | | // 所有上面定义的路由都要写在下面的routes里 |
| | | export const mapRoutes = routes |
| | |
| | | * access: (null) 可访问该页面的权限数组,当前路由设置的权限会影响子路由 |
| | | * } |
| | | */ |
| | | import { mapRoutes } from '@router/map' |
| | | // 默认跳转路由 |
| | | import PipeLineIndex from '../views/baseInfoMgr/pipeline/PipeLineIndex' |
| | | import MapTemplate from '../views/MapTemplate' |
| | | |
| | | // 应用业务相关路由,挂载menu上的page |
| | | export const routes = [{ |
| | | const mainRoutes = [{ |
| | | path: '/', |
| | | name: 'Main', |
| | | component: MapTemplate, |
| | | redirect: '/home', |
| | | redirect: '/mapTemplate', |
| | | children: [{ |
| | | path: 'home', |
| | | name: 'Home', |
| | | meta: { |
| | | title: '首页' |
| | | }, |
| | | component: MapTemplate |
| | | }, { |
| | | path: 'baseInfoMgr/pipeLine', |
| | | name: 'baseInfoMgr', |
| | | component: PipeLineIndex, |
| | |
| | | } |
| | | }] |
| | | }] |
| | | export const routes = [...mainRoutes, ...mapRoutes] |