mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-07-03 14:58:47 +08:00
fix(core): 在 initNode 前校验 config.items 为数组
避免 config.items 非数组时 forEach 抛出运行时错误。
This commit is contained in:
parent
9e8272b521
commit
aa71fe9ddd
@ -76,9 +76,11 @@ class IteratorContainer extends Node {
|
||||
}
|
||||
}
|
||||
|
||||
config.items?.forEach((element: MNode) => {
|
||||
this.initNode(element, node, map);
|
||||
});
|
||||
if (Array.isArray(config.items)) {
|
||||
config.items?.forEach((element: MNode) => {
|
||||
this.initNode(element, node, map);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public setNodes(nodes: MNode[], index: number) {
|
||||
|
||||
@ -79,9 +79,11 @@ class Page extends Node {
|
||||
}
|
||||
}
|
||||
|
||||
config.items?.forEach((element: MComponent | MContainer) => {
|
||||
this.initNode(element, node);
|
||||
});
|
||||
if (Array.isArray(config.items)) {
|
||||
config.items?.forEach((element: MComponent | MContainer) => {
|
||||
this.initNode(element, node);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public getNode<T extends TMagicNode = TMagicNode>(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user