feat(all): 初始化版本
This commit is contained in:
70
leopard-web/src/index.tsx
Normal file
70
leopard-web/src/index.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
import {createRoot} from 'react-dom/client'
|
||||
import {createHashRouter, Navigate, type RouteObject, RouterProvider} from 'react-router'
|
||||
import './index.scss'
|
||||
import './components/amis/Registry.ts'
|
||||
import Overview from "./pages/Overview.tsx";
|
||||
import Root from "./pages/Root.tsx";
|
||||
import Test from "./pages/Test.tsx";
|
||||
import StockList from "./pages/stock/StockList.tsx";
|
||||
import StockDetail from './pages/stock/StockDetail.tsx';
|
||||
import TaskList from "./pages/task/TaskList.tsx";
|
||||
import TaskAdd from './pages/task/TaskAdd.tsx';
|
||||
|
||||
const routes: RouteObject[] = [
|
||||
{
|
||||
path: '/',
|
||||
Component: Root,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Navigate to="/overview" replace/>,
|
||||
},
|
||||
{
|
||||
path: 'overview',
|
||||
Component: Overview,
|
||||
},
|
||||
{
|
||||
path: 'stock',
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Navigate to="/stock/list" replace/>,
|
||||
},
|
||||
{
|
||||
path: 'list',
|
||||
Component: StockList,
|
||||
},
|
||||
{
|
||||
path: 'detail/:id',
|
||||
Component: StockDetail,
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'task',
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Navigate to="/task/list" replace/>,
|
||||
},
|
||||
{
|
||||
path: 'list',
|
||||
Component: TaskList,
|
||||
},
|
||||
{
|
||||
path: 'add',
|
||||
Component: TaskAdd,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'test',
|
||||
Component: Test,
|
||||
}
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<RouterProvider router={createHashRouter(routes)}/>,
|
||||
)
|
||||
Reference in New Issue
Block a user