From 3967971f3c57f6cdde3e41ccb6f652968b8d5173 Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Mon, 11 May 2020 17:21:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=20top=20lest=20=E5=80=BC=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E4=B8=BA=20NaN=20=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/dom.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/dom.tsx b/src/utils/dom.tsx index abfc05c7..85cb66ef 100644 --- a/src/utils/dom.tsx +++ b/src/utils/dom.tsx @@ -152,8 +152,12 @@ export function calculatePosition( const clip = container.getBoundingClientRect(); const clip2 = overlayNode.getBoundingClientRect(); - const scaleX = clip2.width / overlayNode.offsetWidth; - const scaleY = clip2.height / overlayNode.offsetHeight; + const scaleX = overlayNode.offsetWidth + ? clip2.width / overlayNode.offsetWidth + : 1; + const scaleY = overlayNode.offsetHeight + ? clip2.height / overlayNode.offsetHeight + : 1; // auto 尝试四个方向对齐。 placement =