fix(core): getNode 添加stict参数来表示必须知道页面片容器id才会返回页面内的节点
This commit is contained in:
@@ -43,6 +43,7 @@ export const useNode = <T extends TMagicNode = TMagicNode>(
|
||||
iteratorContainerId: props.iteratorContainerId,
|
||||
iteratorIndex: props.iteratorIndex,
|
||||
pageFragmentContainerId: props.pageFragmentContainerId,
|
||||
strict: true,
|
||||
});
|
||||
}
|
||||
return void 0;
|
||||
|
||||
@@ -74,7 +74,7 @@ export const useEditorDsl = (app = inject<TMagicApp>('app'), win = window) => {
|
||||
if (!parent) throw new Error('未找到父节点');
|
||||
|
||||
if (config.type !== 'page') {
|
||||
const parentNode = app?.page?.getNode(parent.id);
|
||||
const parentNode = app?.page?.getNode(parent.id, { strict: true });
|
||||
parentNode && app?.page?.initNode(config, parentNode);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ export const useEditorDsl = (app = inject<TMagicApp>('app'), win = window) => {
|
||||
|
||||
replaceChildNode(reactive(newNode), [root.value], parentId);
|
||||
|
||||
const nodeInstance = app.getNode(config.id);
|
||||
const nodeInstance = app.getNode(config.id, { strict: true });
|
||||
if (nodeInstance) {
|
||||
nodeInstance.setData(newNode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user