Skip to content

Commit

Permalink
[fix]点击侧边栏main面包屑错误修复
Browse files Browse the repository at this point in the history
  • Loading branch information
wuping committed Dec 14, 2023
1 parent 810af23 commit 5bd9247
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/MainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const menuItems: MenuProps['items'] = sliderConfig.map(
key: `${icon.path}`,
label: `${icon.label}`,

children: icon.children?icon.children?.map((_, j) => {
children: icon.children ? icon.children?.map((_, j) => {
return {
key: _.path,
label: `${_.label}`,
};
}):null,
}) : null,
};
},
);
Expand All @@ -25,14 +25,15 @@ const menuItems: MenuProps['items'] = sliderConfig.map(
const MainMenu: React.FC = (props: any) => {
// 侧边栏点击事件
const navigateTo = useNavigate();
const location = useLocation();
const pathArr = getLocationArr(sliderConfig, location.pathname)

const SliderClick = (e: any) => {
navigateTo(e.key)
const pathNameArr = getLabelArr(sliderConfig, location.pathname)
const pathNameArr = getLabelArr(sliderConfig, e.key)
props.pathMethod(pathNameArr)
}
const location = useLocation();
const pathArr = getLocationArr(sliderConfig, location.pathname)
console.log(location, 'location')

return (
<Menu
mode="inline"
Expand Down

0 comments on commit 5bd9247

Please sign in to comment.