From bfa3f528a2288db9836ceaa95671c0f913ca8fba Mon Sep 17 00:00:00 2001 From: atoz03 Date: Fri, 5 Dec 2025 15:11:12 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E4=BA=86dropdown?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E7=AA=97=20-=20ActionDropdown.vue=EF=BC=9A?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=AE=A1=E7=AE=97=E8=B0=83=E6=95=B4=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=85=88=E5=90=91=E5=8F=B3=E5=B1=95=E5=BC=80=E5=B9=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=208px=20=E9=97=B4=E8=B7=9D=EF=BC=8C=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E9=81=AE=E6=8C=A1=E5=B7=A6=E4=BE=A7=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=9B=E4=B8=8B=E6=8B=89=E5=85=A8=E5=B1=80=E4=BA=92=E6=96=A5?= =?UTF-8?q?=E4=BB=8D=E4=BF=9D=E7=95=99=E3=80=82=20=20=20-=20=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E9=A1=B5=E9=9D=A2=EF=BC=9A=E5=88=97=E8=A1=A8=E4=B8=8B?= =?UTF-8?q?=E6=8B=89/=E5=8D=A1=E7=89=87=E5=B7=B2=E6=97=A0=E2=80=9C?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=97=B6=E9=97=B4=E7=BA=BF=E2=80=9D=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=8F=AA=E4=BF=9D=E7=95=99=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E9=A1=B6=E9=83=A8=E6=8C=89=E9=92=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/ActionDropdown.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/web/admin-spa/src/components/common/ActionDropdown.vue b/web/admin-spa/src/components/common/ActionDropdown.vue index 5dadb9fc..be7afc46 100644 --- a/web/admin-spa/src/components/common/ActionDropdown.vue +++ b/web/admin-spa/src/components/common/ActionDropdown.vue @@ -116,7 +116,8 @@ const updateDropdownPosition = () => { const trigger = triggerRef.value.getBoundingClientRect() const dropdownHeight = 200 // 预估高度 - const dropdownWidth = 160 // 预估宽度 + const dropdownWidth = 180 // 预估宽度,略大以减少遮挡 + const gap = 8 const spaceBelow = window.innerHeight - trigger.bottom const spaceAbove = trigger.top const spaceRight = window.innerWidth - trigger.right @@ -126,16 +127,16 @@ const updateDropdownPosition = () => { // 计算垂直位置 if (spaceBelow >= dropdownHeight || spaceBelow >= spaceAbove) { - top = trigger.bottom + 4 + top = trigger.bottom + gap } else { - top = trigger.top - dropdownHeight - 4 + top = trigger.top - dropdownHeight - gap } - // 计算水平位置 - 优先显示在左侧(因为按钮在右侧固定列) - if (spaceLeft >= dropdownWidth) { - left = trigger.left - dropdownWidth + trigger.width - } else if (spaceRight >= dropdownWidth) { - left = trigger.left + // 计算水平位置 - 优先向右展开,避免遮挡左侧内容 + if (spaceRight >= dropdownWidth + gap) { + left = trigger.right + gap + } else if (spaceLeft >= dropdownWidth + gap) { + left = trigger.left - dropdownWidth - gap + trigger.width } else { left = window.innerWidth - dropdownWidth - 10 }