Commit 08294bfa authored by 前端-许佳敏's avatar 前端-许佳敏

优化菜单显示

parent a581508c
......@@ -40,7 +40,7 @@ const MenuSlider = (props) => {
const menuUtil = new MenuUtil({
formatMessage,
})
console.log(menuData)
console.log(selectedKeys)
// 本地可无权限访问所有路由
if (!isDev) {
......
......@@ -30,8 +30,16 @@ export const getSelectedMenuKeys = (
menuData: MenuDataItem[],
): string[] => {
const menus = getMatchMenu(pathname, menuData);
return menus.map(item => item.key || item.path || '');
const dispatchMenu = menus.map(v => {
if (v.hideInMenu) {
const flag = v.key || v.path || ''
const substr = flag.substr(0, flag.lastIndexOf('/'))
v.path = substr
v.key = substr
}
return v
})
return dispatchMenu.map(item => item.key || item.path || '');
};
const Layout = props => {
......
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