| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { createRouter, createWebHistory } from 'vue-router'
- // import HomeView from '@/views/home/index.vue'
- import { authGuard } from './guard'
- // 自动加载modules目录下的所有路由文件
- const moduleRoutes = Object.values(import.meta.glob('./modules/*.ts', { eager: true })).flatMap(
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- (module) => (module as { default: any }).default
- )
- const router = createRouter({
- history: createWebHistory(import.meta.env.BASE_URL),
- routes: [
- // 自动合并所有模块路由
- ...moduleRoutes,
- {
- path: '/',
- name: 'home',
- // component: HomeView,
- // meta: { title: '首页看板', isFullScreen: false, keepAlive: false },
- redirect: '/community/list',
- meta: { title: '小区管理', isFullScreen: false, keepAlive: false, hidden: true },
- },
- {
- path: '/pointCloud',
- name: 'pointCloud',
- component: () => import('@/views/pointCloudMap/index.vue'),
- meta: { title: '设备点云图', isFullScreen: true, keepAlive: false, hidden: true },
- },
- {
- path: '/dashboard',
- name: 'dashboard',
- component: () => import('@/views/dashboard/index.vue'),
- meta: { title: '大屏', isFullScreen: true, keepAlive: false, hidden: true },
- },
- ],
- })
- router.beforeEach(authGuard)
- export default router
|