Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d8f34c32
authored
Mar 17, 2024
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 侧边栏聚焦问题 (close #123)
parent
57194951
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
web/src/components/SiderBar.js
+20
-14
No files found.
web/src/components/SiderBar.js
View file @
d8f34c32
...
@@ -34,6 +34,21 @@ const SiderBar = () => {
...
@@ -34,6 +34,21 @@ const SiderBar = () => {
const
logo
=
getLogo
();
const
logo
=
getLogo
();
const
[
isCollapsed
,
setIsCollapsed
]
=
useState
(
defaultIsCollapsed
);
const
[
isCollapsed
,
setIsCollapsed
]
=
useState
(
defaultIsCollapsed
);
const
routerMap
=
{
home
:
'/'
,
channel
:
'/channel'
,
token
:
'/token'
,
redemption
:
'/redemption'
,
topup
:
'/topup'
,
user
:
'/user'
,
log
:
'/log'
,
midjourney
:
'/midjourney'
,
setting
:
'/setting'
,
about
:
'/about'
,
chat
:
'/chat'
,
detail
:
'/detail'
};
const
headerButtons
=
useMemo
(()
=>
[
const
headerButtons
=
useMemo
(()
=>
[
{
{
text
:
'首页'
,
text
:
'首页'
,
...
@@ -150,6 +165,11 @@ const SiderBar = () => {
...
@@ -150,6 +165,11 @@ const SiderBar = () => {
loadStatus
().
then
(()
=>
{
loadStatus
().
then
(()
=>
{
setIsCollapsed
(
isMobile
()
||
localStorage
.
getItem
(
'default_collapse_sidebar'
)
===
'true'
);
setIsCollapsed
(
isMobile
()
||
localStorage
.
getItem
(
'default_collapse_sidebar'
)
===
'true'
);
});
});
let
localKey
=
window
.
location
.
pathname
.
split
(
'/'
)[
1
]
if
(
localKey
===
''
)
{
localKey
=
'home'
}
setSelectedKeys
([
localKey
]);
},
[]);
},
[]);
return
(
return
(
...
@@ -166,20 +186,6 @@ const SiderBar = () => {
...
@@ -166,20 +186,6 @@ const SiderBar = () => {
}}
}}
selectedKeys
=
{
selectedKeys
}
selectedKeys
=
{
selectedKeys
}
renderWrapper
=
{({
itemElement
,
isSubNav
,
isInSubNav
,
props
})
=>
{
renderWrapper
=
{({
itemElement
,
isSubNav
,
isInSubNav
,
props
})
=>
{
const
routerMap
=
{
home
:
'/'
,
channel
:
'/channel'
,
token
:
'/token'
,
redemption
:
'/redemption'
,
topup
:
'/topup'
,
user
:
'/user'
,
log
:
'/log'
,
midjourney
:
'/midjourney'
,
setting
:
'/setting'
,
about
:
'/about'
,
chat
:
'/chat'
,
detail
:
'/detail'
};
return
(
return
(
<
Link
<
Link
style
=
{{
textDecoration
:
'none'
}}
style
=
{{
textDecoration
:
'none'
}}
...
...
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