提交 3fb538df authored 作者: vipcxj's avatar vipcxj

fix: 左侧菜单生成时内部报错

上级 db5be199
......@@ -17,7 +17,9 @@ const createMenu = async (configure) => {
}
if (configure.children) {
for (const child of configure.children) {
menu.children.push(await createMenu(child));
if (child) {
menu.children.push(await createMenu(child));
}
}
}
if (configure.modules) {
......@@ -26,11 +28,13 @@ const createMenu = async (configure) => {
if (isString(module)) {
info = await getModuleInfo(module);
}
menu.children.push({
name: info.name,
icon: info.icon,
text: info.showName,
});
if (info) {
menu.children.push({
name: info.name,
icon: info.icon,
text: info.showName,
});
}
}
}
return menu;
......@@ -39,9 +43,13 @@ const createMenu = async (configure) => {
const makeIcon = (menu) => {
const children = menu.children;
if (!children || children.length === 0) {
menu.icon = 'file'; // eslint-disable-line no-param-reassign
if (!menu.icon) {
menu.icon = 'file'; // eslint-disable-line no-param-reassign
}
} else {
menu.icon = 'folder'; // eslint-disable-line no-param-reassign
if (!menu.icon) {
menu.icon = 'folder'; // eslint-disable-line no-param-reassign
}
for (const child of children) {
makeIcon(child);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论