feat:init
This commit is contained in:
1 parent
543cecf2ee
commit
ce06ad0214
2 files changed
+35
-1
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { createBrowserRouter } from "react-router-dom";
|
||||
import Layout from "../pages/Layout";
|
||||
import Home from "../pages/Home";
|
||||
import ExperimentDetail from "../pages/ExperimentDetail";
|
||||
import NotFound from "../pages/NotFound";
|
||||
|
||||
/**
|
||||
* 应用路由配置
|
||||
* 使用 React Router v7 的 createBrowserRouter
|
||||
*/
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <Layout />,
|
||||
errorElement: <NotFound />,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: "experiment/:id",
|
||||
element: <ExperimentDetail />,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "*",
|
||||
element: <NotFound />,
|
||||
},
|
||||
]);
|
||||
|
||||
export default router;
|
||||
Reference in new issue
Block a user