fix: harden platform runtime and menu navigation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user