2
0

fix: 静态路由角色拦截限制

This commit is contained in:
TsMask
2024-12-02 16:20:03 +08:00
parent 5e54aaf24d
commit 3f01adb2ad
7 changed files with 78 additions and 118 deletions

View File

@@ -1,57 +1,6 @@
import type { ElegantConstRoute } from '@elegant-router/types';
import { generatedRoutes } from '../elegant/routes';
import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
/**
* custom routes
*
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
*/
const customRoutes: any[] = [
{
name: 'exception',
path: '/exception',
component: 'layout.base',
meta: {
title: 'exception',
i18nKey: 'route.exception',
icon: 'ant-design:exception-outlined',
order: 7
},
children: [
{
name: 'exception_403',
path: '/exception/403',
component: 'view._builtin_403',
meta: {
title: 'exception_403',
i18nKey: 'route.exception_403',
icon: 'ic:baseline-block'
}
},
{
name: 'exception_404',
path: '/exception/404',
component: 'view._builtin_404',
meta: {
title: 'exception_404',
i18nKey: 'route.exception_404',
icon: 'ic:baseline-web-asset-off'
}
},
{
name: 'exception_500',
path: '/exception/500',
component: 'view._builtin_500',
meta: {
title: 'exception_500',
i18nKey: 'route.exception_500',
icon: 'ic:baseline-wifi-off'
}
}
]
}
];
import type {ElegantConstRoute} from '@elegant-router/types';
import {generatedRoutes} from '../elegant/routes';
import {transformElegantRoutesToVueRoutes} from '../elegant/transform';
/** create routes when the auth route mode is static */
export function createStaticRoutes() {
@@ -59,7 +8,7 @@ export function createStaticRoutes() {
const authRoutes: any[] = [];
[...customRoutes, ...generatedRoutes].forEach(item => {
generatedRoutes.forEach(item => {
if (item.meta?.constant) {
constantRoutes.push(item);
} else {