Skip to content

Commit

Permalink
chore(site): links to add query params (#38893)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Nov 23, 2022
1 parent 9e8b834 commit 6aa8002
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .dumi/hooks/useMenu.tsx
Expand Up @@ -10,7 +10,7 @@ export type UseMenuOptions = {

const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] => {
const fullData = useFullSidebarData();
const { pathname } = useLocation();
const { pathname, search } = useLocation();
const sidebarData = useSidebarData();
const { before, after } = options;

Expand Down Expand Up @@ -60,7 +60,7 @@ const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] =>
childItems.push(
...childrenGroup.default.map((item) => ({
label: (
<Link to={item.link}>
<Link to={`${item.link}${search}`}>
{before}
{item.title}
{after}
Expand All @@ -77,7 +77,7 @@ const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] =>
key: type,
children: children?.map((item) => ({
label: (
<Link to={item.link}>
<Link to={`${item.link}${search}`}>
{before}
{item.title}
{after}
Expand All @@ -100,7 +100,7 @@ const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] =>
key: group.title,
children: group.children?.map((item) => ({
label: (
<Link to={item.link}>
<Link to={`${item.link}${search}`}>
{before}
<span key="english">{item.title}</span>
<span className="chinese" key="chinese">
Expand All @@ -117,7 +117,7 @@ const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] =>
result.push(
...group.children?.map((item) => ({
label: (
<Link to={item.link}>
<Link to={`${item.link}${search}`}>
{before}
{item.title}
{after}
Expand All @@ -130,7 +130,7 @@ const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] =>
return result;
}, []) ?? []
);
}, [sidebarData, fullData, pathname]);
}, [sidebarData, fullData, pathname, search]);

return [menuItems, pathname];
};
Expand Down

0 comments on commit 6aa8002

Please sign in to comment.