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