Skip to content

Commit 54c8a28

Browse files
authored
Merge pull request #70 from Tencent/feat/router/hidden
feat(router): add route hidden
2 parents 9472ca6 + 2efb726 commit 54c8a28

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/layouts/components/MenuContent.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ const getMenuList = (list: MenuRoute[], basePath?: string): MenuRoute[] => {
66
if (!list) {
77
return [];
88
}
9-
return list.map((item) => {
10-
const path = basePath ? `${basePath}/${item.path}` : item.path;
11-
return {
12-
path,
13-
title: item.meta?.title,
14-
icon: item.meta?.icon || '',
15-
children: getMenuList(item.children, path),
16-
meta: item.meta,
17-
redirect: item.redirect,
18-
};
19-
});
9+
return list
10+
.map((item) => {
11+
const path = basePath ? `${basePath}/${item.path}` : item.path;
12+
return {
13+
path,
14+
title: item.meta?.title,
15+
icon: item.meta?.icon || '',
16+
children: getMenuList(item.children, path),
17+
meta: item.meta,
18+
redirect: item.redirect,
19+
};
20+
})
21+
.filter((item) => item.meta && item.meta.hidden !== true);
2022
};
2123

2224
const renderIcon = (item) => {

0 commit comments

Comments
 (0)