修复后端返回路由数据中 children 为空数组导致菜单无法正常生成

This commit is contained in:
Hooray Hu
2024-05-14 10:13:34 +08:00
parent c8559883e5
commit 6540d74930
+3 -2
View File
@@ -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)
}
}