fix(components): [el-cascader] suddenly jump to the left (#4516)

This commit is contained in:
Alan Wang 2022-01-19 17:05:11 +08:00 committed by GitHub
parent 7f025e1efc
commit d05acba3d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,14 @@
:append-to-body="popperAppendToBody"
:popper-class="`el-cascader__dropdown ${popperClass}`"
:popper-options="popperOptions"
:fallback-placements="['bottom-start', 'top-start', 'right', 'left']"
:fallback-placements="[
'bottom-start',
'bottom',
'top-start',
'top',
'right',
'left',
]"
:stop-popper-mouse-event="false"
:gpu-acceleration="false"
placement="bottom-start"
@ -215,7 +222,7 @@ const popperOptions: Partial<Options> = {
phase: 'main',
fn: ({ state }) => {
const { modifiersData, placement } = state as any
if (['right', 'left'].includes(placement)) return
if (['right', 'left', 'bottom', 'top'].includes(placement)) return
modifiersData.arrow.x = 35
},
requires: ['arrow'],