feat: 回退页面完善
This commit is contained in:
@@ -1,29 +1,35 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { traverseTreeValues } from '@vben/utils';
|
||||
import { mergeRouteModules } from '@vben-core/helpers';
|
||||
|
||||
import { essentialsRoutes } from './_essentials';
|
||||
import { essentialsRoutes, fallbackNotFoundRoute } from './_essentials';
|
||||
|
||||
const dynamicRouteFiles = import.meta.glob('./dynamic/**/*.ts', {
|
||||
const dynamicRouteFiles = import.meta.glob('./modules/**/*.ts', {
|
||||
eager: true,
|
||||
});
|
||||
|
||||
const staticRouteFiles = import.meta.glob('./static/**/*.ts', { eager: true });
|
||||
|
||||
const externalRouteFiles = import.meta.glob('./external/**/*.ts', {
|
||||
eager: true,
|
||||
});
|
||||
// 有需要可以自行打开注释,并创建文件夹
|
||||
// const staticRouteFiles = import.meta.glob('./static/**/*.ts', { eager: true });
|
||||
|
||||
/** 动态路由 */
|
||||
const dynamicRoutes: RouteRecordRaw[] = mergeRouteModules(dynamicRouteFiles);
|
||||
|
||||
/** 静态路由列表,访问这些页面可以不需要权限 */
|
||||
const staticRoutes: RouteRecordRaw[] = mergeRouteModules(staticRouteFiles);
|
||||
|
||||
/** 排除在主框架外的路由,这些路由没有菜单和顶部及其他框架内容 */
|
||||
const externalRoutes: RouteRecordRaw[] = mergeRouteModules(externalRouteFiles);
|
||||
// const staticRoutes: RouteRecordRaw[] = mergeRouteModules(staticRouteFiles);
|
||||
const staticRoutes: RouteRecordRaw[] = [];
|
||||
|
||||
/** 路由列表,由基本路由+静态路由组成 */
|
||||
const routes: RouteRecordRaw[] = [...essentialsRoutes, ...staticRoutes];
|
||||
const routes: RouteRecordRaw[] = [
|
||||
...essentialsRoutes,
|
||||
...staticRoutes,
|
||||
fallbackNotFoundRoute,
|
||||
];
|
||||
|
||||
export { dynamicRoutes, externalRoutes, routes };
|
||||
/** 基本路由列表,这些路由不需要进入权限拦截 */
|
||||
const essentialsRouteNames = traverseTreeValues(
|
||||
essentialsRoutes,
|
||||
(route) => route.name,
|
||||
);
|
||||
|
||||
export { dynamicRoutes, essentialsRouteNames, routes };
|
||||
|
Reference in New Issue
Block a user