|
|
@ -18,7 +18,7 @@ import type { MenuDataItem } from '@ant-design/pro-layout/es/typing' |
|
|
|
import { convertToMenu, flattenTree } from '@/utils' |
|
|
|
import { Flex, Menu, Space } from 'antd' |
|
|
|
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons' |
|
|
|
import { If } from 'react-if' |
|
|
|
import { If, Then } from 'react-if' |
|
|
|
|
|
|
|
//根据menuData生成Breadcrumb所需的数据
|
|
|
|
const getBreadcrumbData = (menuData: MenuItem[], pathname: string) => { |
|
|
@ -26,6 +26,7 @@ const getBreadcrumbData = (menuData: MenuItem[], pathname: string) => { |
|
|
|
const findItem = (menuData: any[], pathname: string) => { |
|
|
|
for (let i = 0; i < menuData.length; i++) { |
|
|
|
if (menuData[i].path === pathname) { |
|
|
|
menuData[i].label =<span className={'s-title'}>{ menuData[i].name}</span> |
|
|
|
breadcrumbData.push(menuData[i]) |
|
|
|
return true |
|
|
|
} |
|
|
@ -188,6 +189,7 @@ export default () => { |
|
|
|
> |
|
|
|
|
|
|
|
<If condition={childMenuRef.current?.length > 0}> |
|
|
|
<Then> |
|
|
|
<Flex className={styles.childMenus}> |
|
|
|
{ |
|
|
|
!collapsed && <div className={styles.childMenuTop}> |
|
|
@ -207,7 +209,7 @@ export default () => { |
|
|
|
onClick={(menu) => { |
|
|
|
const info = menusFlatten.current?.find(item => item.path === menu.key) |
|
|
|
if (info) { |
|
|
|
setOpenKeys([ info.path as string ]) |
|
|
|
// setOpenKeys([ info.path as string ])
|
|
|
|
navigate({ |
|
|
|
to: info.path, |
|
|
|
}) |
|
|
@ -217,7 +219,7 @@ export default () => { |
|
|
|
items={convertToMenu((childMenuRef.current || []), (item => { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
key: item.path, |
|
|
|
key: item.path || item.meta.name, |
|
|
|
label: item.title, |
|
|
|
} |
|
|
|
})) as any} |
|
|
@ -232,11 +234,13 @@ export default () => { |
|
|
|
} |
|
|
|
</div> |
|
|
|
</Flex> |
|
|
|
</Then> |
|
|
|
</If> |
|
|
|
|
|
|
|
<Flex flex={1} className={styles.body} aria-description={'main-body'} vertical={true}> |
|
|
|
<div className={styles.bodyHeader}> |
|
|
|
<PageBreadcrumb |
|
|
|
menusFlatten={menusFlatten} |
|
|
|
className={'top-breadcrumb'} |
|
|
|
showIcon={false} |
|
|
|
items={items}/> |
|
|
|