Commit 00b68aa0 authored by timel's avatar timel

feat: router

parent ae80738a
Pipeline #22825 passed with stages
in 11 minutes and 41 seconds
......@@ -19,20 +19,17 @@ import { ConfigProvider, theme } from "antd";
import zhCN from "antd/locale/zh_CN";
import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import Neos from "./ui/Neos";
import { NeosRouter } from "./ui/Neos";
const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
);
root.render(
<BrowserRouter>
<ConfigProvider theme={{ algorithm: theme.darkAlgorithm }} locale={zhCN}>
<ProConfigProvider dark>
<Neos />
</ProConfigProvider>
</ConfigProvider>
</BrowserRouter>
<ConfigProvider theme={{ algorithm: theme.darkAlgorithm }} locale={zhCN}>
<ProConfigProvider dark>
<NeosRouter />
</ProConfigProvider>
</ConfigProvider>
);
import React, { Suspense } from "react";
import { Route, Routes } from "react-router-dom";
import {
createBrowserRouter,
createRoutesFromElements,
Route,
RouterProvider,
} from "react-router-dom";
import LazyLoad, { Loading } from "./LazyLoad";
......@@ -12,9 +17,10 @@ const Replay = React.lazy(() => import("./Replay"));
const SSO = React.lazy(() => import("./SSO"));
const Home = React.lazy(() => import("./Home"));
export default function () {
return (
<Routes>
// 暂且先这么写,为后重构为createBrowserRouter打基础
const router = createBrowserRouter(
createRoutesFromElements(
<Route>
<Route path="/" element={<LazyLoad lazy={<Start />} />} />
<Route path="/home" element={<LazyLoad lazy={<Home />} />} />
<Route path="/match" element={<LazyLoad lazy={<Match />} />} />
......@@ -44,6 +50,8 @@ export default function () {
}
/>
<Route path="/sso/*" element={<LazyLoad lazy={<SSO />} />} />
</Routes>
);
}
</Route>
)
);
export const NeosRouter = () => <RouterProvider router={router} />;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment