Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
ems3.3
Commits
107b7d55
Commit
107b7d55
authored
Sep 19, 2023
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asd
parent
c8e83cb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
index.jsx
src/components/TagView/index.jsx
+22
-17
No files found.
src/components/TagView/index.jsx
View file @
107b7d55
/* eslint-disable react/jsx-key */
/* eslint-disable react/jsx-key */
import
React
,
{
useState
,
useEffect
,
useRef
,
memo
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useRef
,
memo
,
cloneElement
,
createElement
}
from
'react'
;
import
{
RouteContext
}
from
'@ant-design/pro-layout'
;
import
{
RouteContext
}
from
'@ant-design/pro-layout'
;
import
{
history
}
from
'@umijs/max'
;
import
{
Outlet
,
history
}
from
'@umijs/max'
;
import
Tags
from
'./Tags'
;
import
Tags
from
'./Tags'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
Scrollbars
}
from
'react-custom-scrollbars'
;
import
{
Scrollbars
}
from
'react-custom-scrollbars'
;
...
@@ -13,7 +13,7 @@ function treeForeach(tree, func) {
...
@@ -13,7 +13,7 @@ function treeForeach(tree, func) {
});
});
}
}
const
TagView
=
({
children
,
home
})
=>
{
const
TagView
=
({
home
})
=>
{
const
[
tagList
,
setTagList
]
=
useState
([]);
const
[
tagList
,
setTagList
]
=
useState
([]);
const
[
currentPath
,
setCurrentPath
]
=
useState
();
const
[
currentPath
,
setCurrentPath
]
=
useState
();
...
@@ -83,12 +83,10 @@ const TagView = ({ children, home }) => {
...
@@ -83,12 +83,10 @@ const TagView = ({ children, home }) => {
tagsCopy
.
push
({
tagsCopy
.
push
({
title
,
title
,
path
,
path
,
children
,
children
:
<
Outlet
/>
,
refresh
:
0
,
refresh
:
0
,
active
:
true
,
active
:
true
,
});
});
await
setrefresh
(
false
);
setrefresh
(
true
);
}
}
return
setTagList
(
tagsCopy
);
return
setTagList
(
tagsCopy
);
...
@@ -125,19 +123,26 @@ const TagView = ({ children, home }) => {
...
@@ -125,19 +123,26 @@ const TagView = ({ children, home }) => {
setTagList
(
tagsCopy
);
setTagList
(
tagsCopy
);
};
};
const
[
refresh
,
setrefresh
]
=
useState
(
true
);
// 刷新选择的标签
// 刷新选择的标签
const
handleRefreshTag
=
async
(
tag
)
=>
{
const
handleRefreshTag
=
async
(
tag
)
=>
{
// const tagsCopy = tagList.map((item) => {
const
tagsCopy0
=
tagList
.
map
((
item
)
=>
{
// if (item.path === tag.path) {
if
(
item
.
path
===
tag
.
path
)
{
// history.push({ pathname: tag?.path, query: tag?.query });
history
.
push
({
pathname
:
tag
?.
path
,
query
:
tag
?.
query
});
// return { ...item, refresh: item.refresh + 1, active: true };
return
{
...
item
,
refresh
:
item
.
refresh
+
1
,
active
:
true
,
children
:
null
};
// }
}
// return { ...item, active: false };
return
{
...
item
,
active
:
false
};
// });
});
// setTagList(tagsCopy);
const
tagsCopy
=
tagList
.
map
((
item
)
=>
{
await
setrefresh
(
false
);
if
(
item
.
path
===
tag
.
path
)
{
setrefresh
(
true
);
history
.
push
({
pathname
:
tag
?.
path
,
query
:
tag
?.
query
});
return
{
...
item
,
refresh
:
item
.
refresh
+
1
,
active
:
true
,
children
:
<
Outlet
/>
};
}
return
{
...
item
,
active
:
false
};
});
setTagList
(
tagsCopy0
);
setTimeout
(()
=>
{
setTagList
(
tagsCopy
);
},
10
);
};
};
return
(
return
(
<>
<>
...
...
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