Blame view

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