From af197363cfaa5c555758c19354a0b3a5031b973e Mon Sep 17 00:00:00 2001 From: roymondchen Date: Fri, 26 Jun 2026 19:51:44 +0800 Subject: [PATCH] fix(vue-runtime-help): handle remove when root is not initialized When root is empty but RemoveData carries app config, update root instead of throwing. --- runtime/vue-runtime-help/package.json | 2 +- runtime/vue-runtime-help/src/hooks/use-editor-dsl.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/runtime/vue-runtime-help/package.json b/runtime/vue-runtime-help/package.json index eb4f600c..f6ff4a07 100644 --- a/runtime/vue-runtime-help/package.json +++ b/runtime/vue-runtime-help/package.json @@ -1,5 +1,5 @@ { - "version": "2.0.3", + "version": "2.0.4", "name": "@tmagic/vue-runtime-help", "type": "module", "sideEffects": false, diff --git a/runtime/vue-runtime-help/src/hooks/use-editor-dsl.ts b/runtime/vue-runtime-help/src/hooks/use-editor-dsl.ts index bb74823f..927e5646 100644 --- a/runtime/vue-runtime-help/src/hooks/use-editor-dsl.ts +++ b/runtime/vue-runtime-help/src/hooks/use-editor-dsl.ts @@ -138,8 +138,14 @@ export const useEditorDsl = (app = inject('app'), runtimeApi: Runtime } }, - remove: ({ id, parentId }: RemoveData) => { - if (!root.value) throw new Error('error'); + remove: ({ id, parentId, root: appConfig }: RemoveData) => { + if (!root.value) { + if (appConfig) { + updateRoot(appConfig); + return; + } + throw new Error('error'); + } const node = getNodePath(id, [root.value]).pop(); if (!node) throw new Error('未找到目标元素');