fix: 修复动态路由问题

This commit is contained in:
2025-02-21 02:25:01 +08:00
parent 6a6b2b0827
commit d5e0f9d5ac
6 changed files with 29 additions and 9 deletions

View File

@@ -188,15 +188,27 @@ class LoginController:
child_node = await cls.find_node_recursive(child_item["id"], data)
if child_node:
children.append(child_node)
result = {
"name": item["name"],
"path": item["path"],
"meta": {
meta = {
k: v for k, v in {
"title": item["title"],
"rank": item["rank"],
"icon": item["icon"],
"extraIcon": item["extraIcon"],
"showParent": item["showParent"],
"keepAlive": item["keepAlive"],
"frameSrc": item["frameSrc"],
"frameLoading": item["frameLoading"],
"permissions": [item["auths"]],
},
}.items() if v
}
if item["showLink"]:
meta["showLink"] = True
else:
meta["showLink"] = False
result = {
"name": item["name"],
"path": item["path"],
"meta": meta,
"children": children
}
if item["component"]:
@@ -209,6 +221,8 @@ class LoginController:
result.pop("name")
if result["children"] == []:
result.pop("children")
else:
result["children"] = sorted(result["children"], key=lambda x: x["meta"]["rank"])
break
return result