From a56af11eb987ffdf3917dbf48cdadff074706e5b Mon Sep 17 00:00:00 2001 From: qinhaoyan Date: Fri, 29 Nov 2024 17:26:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dform=20flex?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B,=E5=BE=80=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=85=83=E7=B4=A0=E4=B8=8A=E9=9D=A2=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor-core/src/layout/flex.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/amis-editor-core/src/layout/flex.ts b/packages/amis-editor-core/src/layout/flex.ts index 90f39b51d60..149344a93f7 100644 --- a/packages/amis-editor-core/src/layout/flex.ts +++ b/packages/amis-editor-core/src/layout/flex.ts @@ -63,8 +63,11 @@ export default class FlexLayout implements LayoutInterface { if (position === 'right') { row = preRow; } + if (position === 'top') { + row = preRow + 1 || 0; // 如果往第一个元素上边插入,preRow为undefined,所以设置0 + } - if (position === 'bottom' || position === 'top') { + if (position === 'bottom') { row = preRow + 1; } } From 2c8c5c6bb662e1e98a9a8cb6905909d95cdb9e8e Mon Sep 17 00:00:00 2001 From: qinhaoyan Date: Fri, 29 Nov 2024 17:27:00 +0800 Subject: [PATCH 2/2] fix --- packages/amis-editor-core/src/layout/flex.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/amis-editor-core/src/layout/flex.ts b/packages/amis-editor-core/src/layout/flex.ts index 149344a93f7..799ecd92239 100644 --- a/packages/amis-editor-core/src/layout/flex.ts +++ b/packages/amis-editor-core/src/layout/flex.ts @@ -59,15 +59,11 @@ export default class FlexLayout implements LayoutInterface { } if (position === 'left') { row = beforeRow; - } - if (position === 'right') { + } else if (position === 'right') { row = preRow; - } - if (position === 'top') { + } else if (position === 'top') { row = preRow + 1 || 0; // 如果往第一个元素上边插入,preRow为undefined,所以设置0 - } - - if (position === 'bottom') { + } else if (position === 'bottom') { row = preRow + 1; } }