feat: 初始化提交
This commit is contained in:
52
client/src/index.tsx
Normal file
52
client/src/index.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
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 Bookshelf from './pages/book/Bookshelf.tsx'
|
||||
import Book from './pages/book/Book.tsx'
|
||||
import Chapter from './pages/book/Chapter.tsx'
|
||||
|
||||
const routes: RouteObject[] = [
|
||||
{
|
||||
path: '/',
|
||||
Component: Root,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Navigate to="/overview" replace/>,
|
||||
},
|
||||
{
|
||||
path: 'overview',
|
||||
Component: Overview,
|
||||
},
|
||||
{
|
||||
path: 'bookshelf',
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
Component: Bookshelf,
|
||||
},
|
||||
{
|
||||
path: 'book/:id',
|
||||
Component: Book,
|
||||
},
|
||||
{
|
||||
path: 'chapter/:id',
|
||||
Component: Chapter,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'test',
|
||||
Component: Test,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<RouterProvider router={createHashRouter(routes)}/>,
|
||||
)
|
||||
Reference in New Issue
Block a user