From 412c78153cc640f0c46a06314e47f66055516106 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 8 Mar 2022 20:08:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E6=9B=B4=E6=96=B0=E6=A0=B9?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/services/editor.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/services/editor.ts b/packages/editor/src/services/editor.ts index b1ffdb56..3679d57d 100644 --- a/packages/editor/src/services/editor.ts +++ b/packages/editor/src/services/editor.ts @@ -289,8 +289,6 @@ class Editor extends BaseService { if (!info.node) throw new Error(`获取不到id为${config.id}的节点`); const node = cloneDeep(toRaw(info.node)); - const { parent } = info; - if (!parent) throw new Error('获取不到父级节点'); let newConfig = await this.toggleFixedPosition(toRaw(config), node, this.get('root')); @@ -303,6 +301,9 @@ class Editor extends BaseService { return newConfig; } + const { parent } = info; + if (!parent) throw new Error('获取不到父级节点'); + const parentNodeItems = parent.items; const index = getNodeIndex(newConfig, parent);