提交 e0e541cb 作者: ZhangLingKun

优化:菜单问题修复

上级 a690d131
流水线 #7658 已通过 于阶段
in 1 分 10 秒
...@@ -94,7 +94,6 @@ export function MenuView() { ...@@ -94,7 +94,6 @@ export function MenuView() {
const brr = getItem(value)?.filter((i: any) => i?.children?.length) || []; const brr = getItem(value)?.filter((i: any) => i?.children?.length) || [];
// 设置要展示的菜单列表 // 设置要展示的菜单列表
setItems([...arr, ...brr]); setItems([...arr, ...brr]);
await getMessageNumber();
}); });
}, []); }, []);
...@@ -103,6 +102,7 @@ export function MenuView() { ...@@ -103,6 +102,7 @@ export function MenuView() {
setOpenKeys([getRoutePid(routerList, location.pathname).toString()]); setOpenKeys([getRoutePid(routerList, location.pathname).toString()]);
// 设置当前选中的项目的subMenu // 设置当前选中的项目的subMenu
setSelectedKeys([getRouteID(routerList, location.pathname).toString()]); setSelectedKeys([getRouteID(routerList, location.pathname).toString()]);
getMessageNumber().then();
}, [location.pathname]); }, [location.pathname]);
return ( return (
<Layout.Sider <Layout.Sider
...@@ -123,7 +123,8 @@ export function MenuView() { ...@@ -123,7 +123,8 @@ export function MenuView() {
// items={items} // items={items}
style={{ backgroundColor: ' #F3F6FF ' }} style={{ backgroundColor: ' #F3F6FF ' }}
> >
{items?.map((i: any) => ( {items?.map((i: any) =>
i?.children ? (
<Menu.SubMenu title={i.label} key={i.key} icon={i.icon}> <Menu.SubMenu title={i.label} key={i.key} icon={i.icon}>
{i?.children?.map((n: any) => ( {i?.children?.map((n: any) => (
<Menu.Item title={n.label} key={n.key} icon={n.icon}> <Menu.Item title={n.label} key={n.key} icon={n.icon}>
...@@ -132,7 +133,13 @@ export function MenuView() { ...@@ -132,7 +133,13 @@ export function MenuView() {
</Menu.Item> </Menu.Item>
))} ))}
</Menu.SubMenu> </Menu.SubMenu>
))} ) : (
<Menu.Item title={i.label} key={i.key} icon={i.icon}>
{i.label}
{!!getTag(i.key) && <div className={'menu-subTag'}>{getTag(i.key)}</div>}
</Menu.Item>
),
)}
</Menu> </Menu>
</Layout.Sider> </Layout.Sider>
); );
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论