Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
Details
Activity
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
ReactWeb5
CivWeb
Commits
aef6f532
Commit
aef6f532
authored
Oct 13, 2021
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复三级菜单高亮选中
parent
aa5771a9
Pipeline
#35945
passed with stages
in 29 minutes 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
BasicLayout1.js
src/layouts/BasicLayout1.js
+20
-10
No files found.
src/layouts/BasicLayout1.js
View file @
aef6f532
import
React
,
{
useCallback
,
useEffect
,
useRef
,
useState
,
...
...
@@ -348,16 +349,24 @@ const BasicLayout = props => {
/**
* web4全屏退出,切换三级菜单高亮
*/
window
.
share
.
event
.
on
(
'event:history'
,
params
=>
{
setTimeout
(()
=>
{
const
routes
=
currentRoutes
.
routes
[
selectIndex
];
if
(
routes
)
{
const
route
=
routes
&&
routes
.
routes
.
find
(
item
=>
item
.
path
===
decodeURI
(
window
.
location
.
pathname
.
replace
(
'/civbase'
,
''
)));
setTabActiveKey
(
route
.
path
)
}
},
0
)
})
useEffect
(()
=>
{
const
routes
=
currentRoutes
.
routes
[
selectIndex
];
if
(
routes
)
{
const
route
=
routes
&&
routes
.
routes
.
find
(
item
=>
item
.
path
===
decodeURI
(
window
.
location
.
pathname
.
replace
(
'/civbase'
,
''
)));
setTabActiveKey
(
route
.
path
)
}
},
[
props
.
location
]);
// window.share.event.on('event:history', params => {
// setTimeout(() => {
// debugger
// const routes = currentRoutes.routes[selectIndex];
// if(routes) {
// const route = routes && routes.routes.find(item => item.path === decodeURI(window.location.pathname.replace('/civbase', '')));
// setTabActiveKey(route.path)
// }
// // window.share.event.removeListener('event:history')
// }, 0)
// })
// window.share && window.share.event.on('event:microError', event => {
// // window.history.pushState({message: '应用服务请求异常,请检查应用配置'}, null, '/civbase/404')
...
...
@@ -385,6 +394,7 @@ const BasicLayout = props => {
if
(
current
.
routes
)
{
setSelectedKeys
([
current
.
routes
[
0
].
href
]);
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
current
.
routes
[
0
].
path
}
`
);
}
else
{
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
current
.
path
}
`
);
}
...
...
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