Commit aef6f532 authored by 邓晓峰's avatar 邓晓峰

fix: 修复三级菜单高亮选中

parent aa5771a9
Pipeline #35945 passed with stages
in 29 minutes 57 seconds
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}`);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment