perf: 路由重构
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { CustomRoute, ElegantConstRoute, ElegantRoute } from '@elegant-router/types';
|
||||
import type { ElegantConstRoute } from '@elegant-router/types';
|
||||
import { generatedRoutes } from '../elegant/routes';
|
||||
import { layouts, views } from '../elegant/imports';
|
||||
import { layouts } from '../elegant/imports';
|
||||
import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
|
||||
|
||||
/**
|
||||
@@ -8,7 +8,7 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
|
||||
*
|
||||
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
|
||||
*/
|
||||
const customRoutes: CustomRoute[] = [
|
||||
const customRoutes: any[] = [
|
||||
{
|
||||
name: 'exception',
|
||||
path: '/exception',
|
||||
@@ -23,7 +23,7 @@ const customRoutes: CustomRoute[] = [
|
||||
{
|
||||
name: 'exception_403',
|
||||
path: '/exception/403',
|
||||
component: 'view.403',
|
||||
component: 'view._builtin_403',
|
||||
meta: {
|
||||
title: 'exception_403',
|
||||
i18nKey: 'route.exception_403',
|
||||
@@ -33,7 +33,7 @@ const customRoutes: CustomRoute[] = [
|
||||
{
|
||||
name: 'exception_404',
|
||||
path: '/exception/404',
|
||||
component: 'view.404',
|
||||
component: 'view._builtin_404',
|
||||
meta: {
|
||||
title: 'exception_404',
|
||||
i18nKey: 'route.exception_404',
|
||||
@@ -43,7 +43,7 @@ const customRoutes: CustomRoute[] = [
|
||||
{
|
||||
name: 'exception_500',
|
||||
path: '/exception/500',
|
||||
component: 'view.500',
|
||||
component: 'view._builtin_500',
|
||||
meta: {
|
||||
title: 'exception_500',
|
||||
i18nKey: 'route.exception_500',
|
||||
@@ -56,9 +56,9 @@ const customRoutes: CustomRoute[] = [
|
||||
|
||||
/** create routes when the auth route mode is static */
|
||||
export function createStaticRoutes() {
|
||||
const constantRoutes: ElegantRoute[] = [];
|
||||
const constantRoutes: any[] = [];
|
||||
|
||||
const authRoutes: ElegantRoute[] = [];
|
||||
const authRoutes: any[] = [];
|
||||
|
||||
[...customRoutes, ...generatedRoutes].forEach(item => {
|
||||
if (item.meta?.constant) {
|
||||
@@ -80,5 +80,5 @@ export function createStaticRoutes() {
|
||||
* @param routes Elegant routes
|
||||
*/
|
||||
export function getAuthVueRoutes(routes: ElegantConstRoute[]) {
|
||||
return transformElegantRoutesToVueRoutes(routes, layouts, views);
|
||||
return transformElegantRoutesToVueRoutes(routes, layouts);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user