Skip to content

Commit

Permalink
feat: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed May 12, 2024
1 parent 2ca48b9 commit 6737ada
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/js/config/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const router: readonly Route<Meta>[] = [
path: 'tabs',
meta: {
name: '标签导航',
// type: MenuType.TABS,
type: MenuType.TABS,
icon: <Icon component={TabsIcon} />
},
element: lazy(() => import('/js/components/RouteTabs')),
Expand All @@ -143,7 +143,7 @@ export const router: readonly Route<Meta>[] = [
path: 'first',
meta: {
name: '标签页一一',
// type: MenuType.HIDDEN,
type: MenuType.HIDDEN,
icon: <Icon component={PageIcon} />
},
element: lazy(() => import('/js/pages/System/Tabs/First'))
Expand Down
14 changes: 6 additions & 8 deletions app/js/utils/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export function nparse<M = unknown>(
} else {
const parentKey = parent ? parent.meta.key : null;

if (parentKey) {
removeable.delete(parentKey);
}

if (icon == null) {
mapping.set(key, [parentKey, transform({ key, name, link }, node)]);
} else {
Expand All @@ -103,14 +107,8 @@ export function nparse<M = unknown>(

console.group('菜单转换过滤');

for (const [, [parentKey]] of mapping) {
if (parentKey) {
removeable.delete(parentKey);
}
}

console.log('已删除的菜单', removeable);
console.log('过滤菜单长度', mapping.size);
console.log('可删除菜单', removeable);
console.log('映射菜单数', mapping.size);

for (const [key, [parentKey, menu]] of mapping) {
if (!removeable.has(key)) {
Expand Down

0 comments on commit 6737ada

Please sign in to comment.