Skip to content

Commit

Permalink
修复后端返回路由数据中 children 为空数组导致菜单无法正常生成
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed May 14, 2024
1 parent c855988 commit 6540d74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/store/modules/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@ const useMenuStore = defineStore(
menus.forEach((menu) => {
if (hasPermission(permissions, menu)) {
const tmpMenu = cloneDeep(menu)
if (tmpMenu.children) {
if (tmpMenu.children && tmpMenu.children.length > 0) {
tmpMenu.children = filterAsyncMenus(tmpMenu.children, permissions) as Menu.recordRaw[]
tmpMenu.children.length && res.push(tmpMenu)
tmpMenu.children.length > 0 && res.push(tmpMenu)
}
else {
delete tmpMenu.children
res.push(tmpMenu)
}
}
Expand Down

0 comments on commit 6540d74

Please sign in to comment.