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
fdd1ae1f
Commit
fdd1ae1f
authored
Feb 19, 2023
by
Chunchi Che
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add LazyLoad component
parent
2ba42c05
Pipeline
#20267
passed with stages
in 3 minutes and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
30 deletions
+20
-30
src/ui/LazyLoad.tsx
src/ui/LazyLoad.tsx
+8
-0
src/ui/Neos.tsx
src/ui/Neos.tsx
+12
-30
No files found.
src/ui/LazyLoad.tsx
0 → 100644
View file @
fdd1ae1f
import
React
,
{
Suspense
}
from
"
react
"
;
const
LazyLoad
=
(
props
:
{
lazy
:
React
.
ReactNode
})
=>
{
return
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
{
props
.
lazy
}
</
Suspense
>;
};
export
const
lazyImport
=
(
module
:
string
)
=>
React
.
lazy
(()
=>
import
(
module
));
export
default
LazyLoad
;
src/ui/Neos.tsx
View file @
fdd1ae1f
import
React
,
{
Suspense
}
from
"
react
"
;
import
React
from
"
react
"
;
import
{
Routes
,
Route
}
from
"
react-router-dom
"
;
import
{
Routes
,
Route
}
from
"
react-router-dom
"
;
import
LazyLoad
,
{
lazyImport
}
from
"
./LazyLoad
"
;
const
Login
=
React
.
lazy
(()
=>
import
(
"
./Login
"
)
);
const
Login
=
lazyImport
(
"
./Login
"
);
const
WaitRoom
=
React
.
lazy
(()
=>
import
(
"
./WaitRoom
"
)
);
const
WaitRoom
=
lazyImport
(
"
./WaitRoom
"
);
const
Mora
=
React
.
lazy
(()
=>
import
(
"
./Mora
"
)
);
const
Mora
=
lazyImport
(
"
./Mora
"
);
const
NeosDuel
=
React
.
lazy
(()
=>
import
(
"
./Duel/main
"
)
);
const
NeosDuel
=
lazyImport
(
"
./Duel/main
"
);
export
default
function
()
{
export
default
function
()
{
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
return
(
return
(
<
Routes
>
<
Routes
>
<
Route
<
Route
path=
"/"
element=
{
<
LazyLoad
lazy=
{
<
Login
/>
}
/>
}
/>
path=
"/"
element=
{
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
Login
/>
</
Suspense
>
}
/>
<
Route
<
Route
path=
"/room/:player/:passWd/:ip"
path=
"/room/:player/:passWd/:ip"
element=
{
element=
{
<
LazyLoad
lazy=
{
<
WaitRoom
/>
}
/>
}
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
WaitRoom
/>
</
Suspense
>
}
/>
/>
<
Route
<
Route
path=
"/room/:player/:passWd/:ip"
path=
"/mora/:player/:passWd/:ip"
element=
{
element=
{
<
LazyLoad
lazy=
{
<
Mora
/>
}
/>
}
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
Mora
/>
</
Suspense
>
}
/>
/>
<
Route
<
Route
path=
"/room/:player/:passWd/:ip"
path=
"/duel/:player/:passWd/:ip"
element=
{
element=
{
<
LazyLoad
lazy=
{
<
NeosDuel
/>
}
/>
}
<
Suspense
fallback=
{
<
div
>
Loading...
</
div
>
}
>
<
NeosDuel
/>
</
Suspense
>
}
/>
/>
</
Routes
>
</
Routes
>
);
);
...
...
Chunchi Che
@SKTT1Ryze
mentioned in commit
79c08127
·
Feb 19, 2023
mentioned in commit
79c08127
mentioned in commit 79c08127fd428d9b0643b7e1e818c29e6ca7c7e2
Toggle commit list
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