Blame view

src/router/routes/index.ts 1019 Bytes
陈文彬 authored
1
2
3
4
import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';

import { DEFAULT_LAYOUT_COMPONENT, PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '../constant';
import { genRouteModule } from '/@/utils/helper/routeHelper';
vben authored
5
import modules from 'globby!/@/router/routes/modules/**/*.@(ts)';
陈文彬 authored
6
vben authored
7
const routeModuleList: AppRouteModule[] = [];
陈文彬 authored
8
vben authored
9
10
11
12
Object.keys(modules).forEach((key) => {
  routeModuleList.push(modules[key]);
});
陈文彬 authored
13
14
15
16
17
export const asyncRoutes = [
  REDIRECT_ROUTE,
  PAGE_NOT_FOUND_ROUTE,
  ...genRouteModule(routeModuleList),
];
vben authored
18
陈文彬 authored
19
20
21
22
23
24
25
26
27
28
29
30
// 主框架根路由
export const RootRoute: AppRouteRecordRaw = {
  path: '/',
  name: 'Root',
  component: DEFAULT_LAYOUT_COMPONENT,
  redirect: '/dashboard',
  meta: {
    title: 'Root',
  },
  children: [],
};
vben authored
31
32
33
34
35
36
37
38
39
export const LoginRoute: AppRouteRecordRaw = {
  path: '/login',
  name: 'Login',
  component: () => import('/@/views/sys/login/Login.vue'),
  meta: {
    title: '登录',
  },
};
陈文彬 authored
40
41
// 基础路由 不用权限
export const basicRoutes = [LoginRoute, RootRoute];