From 7c5c12856e77b89f83d1cfe48bf88bcd5441bed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Fri, 1 Mar 2024 09:49:32 +0800 Subject: [PATCH] =?UTF-8?q?BI-144444=20fix:=20=E3=80=90v5=E3=80=91?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=BB=84=E4=BB=B6=E5=90=91=E4=B8=8B=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E4=B8=8B=EF=BC=8C=E5=90=91=E4=B8=8A=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E6=97=B6=E5=80=99=E4=BC=9A=E6=8C=A1=E4=BD=8F?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E6=9D=BF=E7=9A=84tab=E6=A0=8F=EF=BC=8C?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=E4=B8=8D=E5=A5=BD=EF=BC=8C=E7=9C=8B=E4=B8=8B?= =?UTF-8?q?=E8=83=BD=E4=B8=8D=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将needAtaptHeight的修正逻辑细化不遮挡el --- packages/fineui/src/core/utils/dom.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/fineui/src/core/utils/dom.js b/packages/fineui/src/core/utils/dom.js index df573a746..216587ec3 100644 --- a/packages/fineui/src/core/utils/dom.js +++ b/packages/fineui/src/core/utils/dom.js @@ -66,10 +66,10 @@ export function preloadImages(srcArray, onload) { each(srcArray, (i, src) => { images[i] = new Image(); images[i].src = src; - images[i].onload = function() { + images[i].onload = function () { complete(); }; - images[i].onerror = function() { + images[i].onerror = function () { complete(); }; }); @@ -741,8 +741,14 @@ export function getComboPosition(combo, popup, extraWidth, extraHeight, needAdap default: break; } - if (needAdaptHeight === true) { - popup.resetHeight && popup.resetHeight(Math.min(viewportBounds.height - position.top - (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight)); + if (needAdaptHeight === true && popup.resetHeight) { + const comboRect = combo.element[0].getBoundingClientRect(); + const relativeOffset = positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0; + if (position.top < comboRect.top) { + popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, comboRect.top, maxHeight)); + } else if (position.top > comboRect.bottom) { + popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, viewportBounds.height - comboRect.bottom, maxHeight)); + } } return position;