fix: 修复动态路由问题
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user