Commit 1a46c6e9 authored by hzq's avatar hzq Committed by 陈帅

Update SiderMenu.js

当权限子菜单无权限或不存在子菜单时不展示父菜单
parent a28a71e9
...@@ -113,23 +113,27 @@ export default class SiderMenu extends PureComponent { ...@@ -113,23 +113,27 @@ export default class SiderMenu extends PureComponent {
*/ */
getSubMenuOrItem = (item) => { getSubMenuOrItem = (item) => {
if (item.children && item.children.some(child => child.name)) { if (item.children && item.children.some(child => child.name)) {
return ( const childrenItems = this.getNavMenuItems(item.children);
<SubMenu // 当无子菜单时就不展示菜单
title={ if (childrenItems && childrenItems.length > 0) {
item.icon ? ( return (
<span> <SubMenu
{getIcon(item.icon)} title={
<span>{item.name}</span> item.icon ? (
</span> <span>
) : ( {getIcon(item.icon)}
item.name <span>{item.name}</span>
) </span>
} ) : (
key={item.path} item.name
> )
{this.getNavMenuItems(item.children)} }
</SubMenu> key={item.path}
); >
{childrenItems}
</SubMenu>
)
}
} else { } else {
return ( return (
<Menu.Item key={item.path}>{this.getMenuItemPath(item)}</Menu.Item> <Menu.Item key={item.path}>{this.getMenuItemPath(item)}</Menu.Item>
......
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