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

优化菜单显示

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