fix: harden platform runtime and menu navigation

This commit is contained in:
david
2026-07-29 18:38:01 +08:00
parent fa21507a68
commit 5af729326c
7 changed files with 131 additions and 12 deletions

View File

@@ -69,8 +69,16 @@ const canArchive = computed(
const tree = computed(() => {
const byIdentity = new Map<string, Node>();
const roots: Node[] = [];
for (const item of list.value)
byIdentity.set(item.identity, { ...item, children: [] });
for (const item of list.value) {
// Arco Tree 把 data.icon 当作图标渲染函数;平台菜单接口返回的是字符串图标名,
// 直接透传会导致 renderFunc is not a function 并破坏后续路由渲染。
const { icon, ...data } = item;
byIdentity.set(item.identity, {
...data,
...(typeof icon === 'string' ? { icon_name: icon } : {}),
children: [],
});
}
for (const item of byIdentity.values()) {
const parent = item.parent_identity
? byIdentity.get(item.parent_identity)