Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dream2023 committed Dec 7, 2023
2 parents 12067e5 + 66b6607 commit 023613d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dumi-theme-nocobase",
"version": "0.2.20",
"version": "0.2.21",
"description": "",
"keywords": [
"dumi",
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/useMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] =>
) : (
<span>{menu.title}</span>
),
children: menu.children.map((item) => processMenu(item, menu.title))
children: menu.children.map((item) => processMenu(item, menu.title)),
disabled: menu.disabled || !menu.children?.length
};
}
if (isItemMenu(menu)) {
Expand All @@ -118,7 +119,8 @@ const useMenu = (options: UseMenuOptions = {}): [MenuProps['items'], string] =>
)}
</ExternalLink>
),
key: menu.link
key: menu.link,
disabled: menu.disabled || menu.link === '#'
};
}
return null;
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ export type SidebarEnhanceItemType = {
subTitle?: string;
link: string;
target?: string;
disabled?: boolean;
};

export type SidebarEnhanceChildrenType = string | SidebarEnhanceItemType;
export type SidebarEnhanceSubType = {
children: SidebarEnhanceChildrenType[];
title: string;
subTitle?: string;
disabled?: boolean;
};

// 增强模式的 sidebar 相关类型
Expand Down

0 comments on commit 023613d

Please sign in to comment.