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
3af90390
authored
Apr 01, 2024
by
QuentinHsu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf(Setting): add tabActiveKey state to Setting component
parent
a8433823
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
web/src/pages/Setting/index.js
+8
-3
No files found.
web/src/pages/Setting/index.js
View file @
3af90390
import
React
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
SystemSetting
from
'../../components/SystemSetting'
;
import
{
isRoot
}
from
'../../helpers'
;
import
OtherSetting
from
'../../components/OtherSetting'
;
...
...
@@ -7,6 +7,7 @@ import OperationSetting from '../../components/OperationSetting';
import
{
Layout
,
TabPane
,
Tabs
}
from
'@douyinfe/semi-ui'
;
const
Setting
=
()
=>
{
const
[
tabActiveKey
,
setTabActiveKey
]
=
useState
(
'1'
);
let
panes
=
[
{
tab
:
'个人设置'
,
...
...
@@ -37,10 +38,14 @@ const Setting = () => {
<
div
>
<
Layout
>
<
Layout
.
Content
>
<
Tabs
type
=
'line'
defaultActiveKey
=
'1'
>
<
Tabs
type
=
'line'
defaultActiveKey
=
'1'
onChange
=
{(
key
)
=>
setTabActiveKey
(
key
)}
>
{
panes
.
map
((
pane
)
=>
(
<
TabPane
itemKey
=
{
pane
.
itemKey
}
tab
=
{
pane
.
tab
}
key
=
{
pane
.
itemKey
}
>
{
pane
.
content
}
{
tabActiveKey
===
pane
.
itemKey
&&
pane
.
content
}
<
/TabPane
>
))}
<
/Tabs
>
...
...
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