mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-07-13 22:52:31 +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) => {
|
if (Array.isArray(config.items)) {
|
||||||
this.initNode(element, node, map);
|
config.items?.forEach((element: MNode) => {
|
||||||
});
|
this.initNode(element, node, map);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public setNodes(nodes: MNode[], index: number) {
|
public setNodes(nodes: MNode[], index: number) {
|
||||||
|
|||||||
@ -79,9 +79,11 @@ class Page extends Node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.items?.forEach((element: MComponent | MContainer) => {
|
if (Array.isArray(config.items)) {
|
||||||
this.initNode(element, node);
|
config.items?.forEach((element: MComponent | MContainer) => {
|
||||||
});
|
this.initNode(element, node);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNode<T extends TMagicNode = TMagicNode>(
|
public getNode<T extends TMagicNode = TMagicNode>(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user