ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

Dropdown组件绝对定位的top和left偏移量 有时候计算错误

Open rose-sun opened this issue 1 year ago • 1 comments
trafficstars

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.2.6

Environment

vue 3.2.6

Reproduction link

Edit on CodeSandbox

Steps to reproduce

我设置了Dropdown的getPopupContainer属性为其父元素,没有设置placement属性,让其自动计算朝向。 正常情况下,bottomLeft的绝对偏移量应该是 left: -1px; top: 28px左右,Dropdown能正常显示在bottomLeft方位; 但是有 1/5 的概率,计算出来的left: 277px; top: -550px,导致Dropdown框溢出容器,根本看不到了。 我是这么写的: <a-dropdown :trigger="['hover']" :mouseEnterDelay="0.3" :mouseLeaveDelay="0.2" :getPopupContainer="(triggerNode) =>triggerNode.parentElement">

What is expected?

期望能正常计算其偏移量,不要偏移过大,导致看不到框

What is actually happening?

多次尝试,有1/5概率Dropdown组件的偏移量计算错误

rose-sun avatar Apr 07 '24 12:04 rose-sun

getPopupContainer多加几个parentNode试试,我偶尔也会这样,直接定位到最最最外层的元素上,有时候父元素的宽度计算的有问题

qhl123456 avatar May 07 '24 06:05 qhl123456

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Jul 07 '24 02:07 github-actions[bot]