vben
2020-12-03 c303ec1a23c4b1fbad4fbda9007af2147dc327e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';
 
import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE, LAYOUT } from '../constant';
import { PageEnum } from '/@/enums/pageEnum';
 
import modules from 'globby!/@/router/routes/modules/**/*.@(ts)';
 
const routeModuleList: AppRouteModule[] = [];
 
Object.keys(modules).forEach((key) => {
  const mod = Array.isArray(modules[key]) ? [...modules[key]] : [modules[key]];
  routeModuleList.push(...mod);
});
 
export const asyncRoutes = [PAGE_NOT_FOUND_ROUTE, ...routeModuleList];
 
const MainRoute: AppRouteModule = {
  path: '/',
  name: 'MainRoute',
  component: LAYOUT,
  redirect: PageEnum.BASE_HOME,
  meta: {
    icon: 'ant-design:home-outlined',
    title: 'routes.dashboard.dashboard',
  },
};
 
export const LoginRoute: AppRouteRecordRaw = {
  path: '/login',
  name: 'Login',
  component: () => import('/@/views/sys/login/Login.vue'),
  meta: {
    title: 'routes.basic.login',
  },
};
 
// 基础路由 不用权限
export const basicRoutes = [LoginRoute, MainRoute, REDIRECT_ROUTE];