Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
00b68aa0
Commit
00b68aa0
authored
Jul 28, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: router
parent
ae80738a
Pipeline
#22825
passed with stages
in 11 minutes and 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
16 deletions
+21
-16
src/main.tsx
src/main.tsx
+6
-9
src/ui/Neos.tsx
src/ui/Neos.tsx
+15
-7
No files found.
src/main.tsx
View file @
00b68aa0
...
...
@@ -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
>
);
src/ui/Neos.tsx
View file @
00b68aa0
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
}
/>;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment