Blame view

src/router/routes/index.ts 1.12 KB
陈文彬 authored
1
2
import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';
3
import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/routes/basic';
vben authored
4
vben authored
5
import { mainOutRoutes } from './mainOut';
vben authored
6
import { PageEnum } from '/@/enums/pageEnum';
7
8
import { t } from '/@/hooks/web/useI18n';
9
const modules = import.meta.globEager('./modules/**/*.ts');
vben authored
10
vben authored
11
const routeModuleList: AppRouteModule[] = [];
陈文彬 authored
12
vben authored
13
Object.keys(modules).forEach((key) => {
vben authored
14
15
16
  const mod = modules[key].default || {};
  const modList = Array.isArray(mod) ? [...mod] : [mod];
  routeModuleList.push(...modList);
vben authored
17
18
});
vben authored
19
export const asyncRoutes = [PAGE_NOT_FOUND_ROUTE, ...routeModuleList];
vben authored
20
vben authored
21
22
23
24
25
26
27
28
29
export const RootRoute: AppRouteRecordRaw = {
  path: '/',
  name: 'Root',
  redirect: PageEnum.BASE_HOME,
  meta: {
    title: 'Root',
  },
};
vben authored
30
31
32
33
34
export const LoginRoute: AppRouteRecordRaw = {
  path: '/login',
  name: 'Login',
  component: () => import('/@/views/sys/login/Login.vue'),
  meta: {
35
    title: t('routes.basic.login'),
vben authored
36
37
38
  },
};
39
// Basic routing without permission
40
41
42
43
44
45
46
export const basicRoutes = [
  LoginRoute,
  RootRoute,
  ...mainOutRoutes,
  REDIRECT_ROUTE,
  PAGE_NOT_FOUND_ROUTE,
];