1
0
mirror of synced 2026-04-05 07:48:35 +08:00

fix(core): getNode 添加stict参数来表示必须知道页面片容器id才会返回页面内的节点

This commit is contained in:
roymondchen
2025-12-09 15:51:15 +08:00
parent b3ce1a3b93
commit 83664cd440
9 changed files with 18 additions and 12 deletions

View File

@@ -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;

View File

@@ -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);
}