fix: 样本管理

This commit is contained in:
2026-02-27 10:34:49 +08:00
parent a5d3342d93
commit 912ab4c321
10 changed files with 47 additions and 57 deletions

View File

@@ -37,28 +37,11 @@ export const loopMenuItem = (
</React.Suspense>
);
} else if (item.children && item.children.length > 0) {
// routeItem.redirect = "/prod/list";
// // 只有当没有 Component 但有子菜单时,才添加重定向
// const firstLeafPath = getFirstLeafPath(item.children);
// // 确保 firstLeafPath 存在,且不是一个会导致循环的路径
// if (
// firstLeafPath &&
// firstLeafPath !== item.path &&
// firstLeafPath.length > 0
// ) {
// // 在 UmiJS 中,路径是相对的,不需要构建完整路径
// const separator =
// item.path.endsWith("/") || firstLeafPath.startsWith("/") ? "" : "/";
// const fullPath = `${item.path}${separator}${firstLeafPath}`;
// console.log(`Redirecting from ${item.path} to ${fullPath}`);
// routeItem.element = <Navigate to={fullPath} replace={true} />;
// }
}
// 处理子菜单
if (item.children && item.children.length > 0) {
routeItem.children = loopMenuItem(item.children, item.id);
}
return routeItem;
});
};