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

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

parent aa5771a9
Pipeline #35945 passed with stages
in 29 minutes 57 seconds
import React, { import React, {
useCallback,
useEffect, useEffect,
useRef, useRef,
useState, useState,
...@@ -348,16 +349,24 @@ const BasicLayout = props => { ...@@ -348,16 +349,24 @@ const BasicLayout = props => {
/** /**
* web4全屏退出,切换三级菜单高亮 * web4全屏退出,切换三级菜单高亮
*/ */
window.share.event.on('event:history', params => { useEffect(() => {
setTimeout(() => { const routes = currentRoutes.routes[selectIndex];
const routes = currentRoutes.routes[selectIndex]; if(routes) {
if(routes) { const route = routes && routes.routes.find(item => item.path === decodeURI(window.location.pathname.replace('/civbase', '')));
const route = routes && routes.routes.find(item => item.path === decodeURI(window.location.pathname.replace('/civbase', ''))); setTabActiveKey(route.path)
setTabActiveKey(route.path) }
} }, [props.location]);
}, 0) // 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.share && window.share.event.on('event:microError', event => {
// // window.history.pushState({message: '应用服务请求异常,请检查应用配置'}, null, '/civbase/404') // // window.history.pushState({message: '应用服务请求异常,请检查应用配置'}, null, '/civbase/404')
...@@ -385,6 +394,7 @@ const BasicLayout = props => { ...@@ -385,6 +394,7 @@ const BasicLayout = props => {
if(current.routes) { if(current.routes) {
setSelectedKeys([current.routes[0].href]); setSelectedKeys([current.routes[0].href]);
window.history.pushState(null, '', `/civbase${current.routes[0].path}`); window.history.pushState(null, '', `/civbase${current.routes[0].path}`);
} else { } else {
window.history.pushState(null, '', `/civbase${current.path}`); 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