index.ts 2.46 KB
import {createRouter, createWebHistory} from "vue-router";

let routes = [
  {
    path: '/',
    name: 'index',
    //使用import可以路由懒加载,如果不使用,太多组件一起加载会造成白屏
    component: () => import('../layout/layout.vue'),
    children: [
      {
        //配置404页面
        path: '/:catchAll(.*)',
        name: '404',
        // @ts-ignore
        component: () => import('../view/404.vue'),
        meta: {title: '404', icon: ''}
      },
      {
        path: '/',
        name: 'index',
        component: () => import('../view/index.vue'),
        meta: {title: '首页', noCache: true, affix: true}
      }, {
        path: '/personCenter',
        name: 'personCenter',
        component: () => import('../view/personCenter/personCenter.vue'),
        meta: {title: '个人中心', noCache: true, affix: true},
        children: [
          {
            path: 'monitorEnterprise',
            name: 'monitorEnterprise',
            component: () => import('../view/personCenter/monitorEnterprise.vue'),
            meta: {title: '监控企业列表', noCache: true, affix: true},
            children: [
              {
                path: '',
                name: 'monitorList',
                component: () => import('../view/personCenter/monitorList.vue'),
                meta: {title: '当前账号监控企业列表', noCache: true, affix: true}
              }, {
                path: 'monitorListAll',
                name: 'monitorListAll',
                component: () => import('../view/personCenter/monitorListAll.vue'),
                meta: {title: '全部监控企业列表', noCache: true, affix: true}
              },
            ]
          }, {
            path: '',
            name: 'monitorSetting',
            component: () => import('../view/personCenter/monitorSetting.vue'),
            meta: {title: '风险动态监控设置', noCache: true, affix: true}
          }, {
            path: 'monitorManager',
            name: 'monitorManager',
            component: () => import('../view/personCenter/monitorManager.vue'),
            meta: {title: '风险动态监控维度', noCache: true, affix: true}
          },
        ]
      }
    ]
  }, {
    path: '/login',
    name: 'login',
    component: () => import('../view/login.vue'),
    meta: {title: '信用管家-登录', noCache: true, affix: true}
  },
]
// 路由
const router = createRouter({
  history: createWebHistory(),
  routes
})
// 导出
export default router