feat: init

This commit is contained in:
2025-09-04 11:29:00 +08:00
parent 2c9059ce2f
commit ddbee614e8
89 changed files with 3476 additions and 349 deletions

View File

@@ -0,0 +1,27 @@
import {Route, Routes} from 'react-router-dom';
import {routes, AppRoute} from './routes';
import AuthRoute from './auth.tsx';
/**
* 渲染路由
* @constructor RenderRoutes
*/
export const RenderRoutes = () => {
const renderRoutes = (routes: AppRoute[]) => {
return routes.map(route => (
<Route
key={route.path}
path={route.path}
element={
<AuthRoute auth={route.auth}>
{route.element}
</AuthRoute>
}
>
{route.children && renderRoutes(route.children)}
</Route>
));
};
return <Routes>{renderRoutes(routes)}</Routes>;
};