mirror of https://gitee.com/answerdev/answer.git
commit
ffb2b6ddc8
|
@ -2,9 +2,10 @@ import React, { Suspense, lazy } from 'react';
|
|||
import { RouteObject, createBrowserRouter } from 'react-router-dom';
|
||||
|
||||
import Layout from '@answer/pages/Layout';
|
||||
import routeConfig from '@/router/route-config';
|
||||
|
||||
import routeConfig, { RouteNode } from '@/router/route-config';
|
||||
import RouteRules from '@/router/route-rules';
|
||||
import { RouteNode } from '@/router/types';
|
||||
|
||||
const routes: RouteObject[] = [];
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import { RouteObject } from 'react-router-dom';
|
||||
import { RouteNode } from '@/router/types';
|
||||
|
||||
export interface RouteNode extends RouteObject {
|
||||
page: string;
|
||||
children?: RouteNode[];
|
||||
rules?: string[];
|
||||
}
|
||||
const routeConfig: RouteNode[] = [
|
||||
{
|
||||
path: '/',
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import { IndexRouteObject, NonIndexRouteObject } from 'react-router-dom';
|
||||
|
||||
type CustomRouteObject = {
|
||||
page: string;
|
||||
rules?: string[];
|
||||
};
|
||||
|
||||
type IndexRouteNode = IndexRouteObject & CustomRouteObject;
|
||||
|
||||
interface NonIndexRouteNode extends NonIndexRouteObject, CustomRouteObject {
|
||||
children?: (IndexRouteNode | NonIndexRouteNode)[];
|
||||
}
|
||||
|
||||
export type RouteNode = IndexRouteNode | NonIndexRouteNode;
|
Loading…
Reference in New Issue