vue-vben-admin/src/router/routes/index.ts

42 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-09-28 20:19:10 +08:00
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';
2020-10-16 22:03:44 +08:00
import modules from 'globby!/@/router/routes/modules/**/*.@(ts)';
2020-09-28 20:19:10 +08:00
2020-10-30 21:32:05 +08:00
const routeModuleList: AppRouteModule[] = [];
2020-09-28 20:19:10 +08:00
2020-10-16 22:03:44 +08:00
Object.keys(modules).forEach((key) => {
routeModuleList.push(modules[key]);
});
2020-09-28 20:19:10 +08:00
export const asyncRoutes = [
REDIRECT_ROUTE,
PAGE_NOT_FOUND_ROUTE,
...genRouteModule(routeModuleList),
];
2020-10-30 21:32:05 +08:00
2020-09-28 20:19:10 +08:00
// 主框架根路由
export const RootRoute: AppRouteRecordRaw = {
path: '/',
name: 'Root',
component: DEFAULT_LAYOUT_COMPONENT,
redirect: '/dashboard',
meta: {
title: 'Root',
},
children: [],
};
2020-10-14 21:08:07 +08:00
export const LoginRoute: AppRouteRecordRaw = {
path: '/login',
name: 'Login',
component: () => import('/@/views/sys/login/Login.vue'),
meta: {
2020-11-26 21:10:21 +08:00
title: 'routes.basic.login',
2020-10-14 21:08:07 +08:00
},
};
2020-09-28 20:19:10 +08:00
// 基础路由 不用权限
export const basicRoutes = [LoginRoute, RootRoute];