fix(components): [popper] zIndex bug (#7115)

* fix: popper zIndex bug

* fix: add shouldUpdateZIndex control ZIndex

Co-authored-by: xiaochenchen <xiaochen.chen@igg.com>
This commit is contained in:
Xc 2022-04-15 09:00:45 +08:00 committed by GitHub
parent 971d58d9f4
commit 9f6a32fb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,9 +71,9 @@ const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
return createPopper(referenceEl, popperContentEl, options)
}
const updatePopper = () => {
const updatePopper = (shouldUpdateZIndex = true) => {
unref(popperInstanceRef)?.update()
contentZIndex.value = props.zIndex || contentZIndex.value || nextZIndex()
shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex())
}
const togglePopperAlive = () => {
@ -82,7 +82,7 @@ const togglePopperAlive = () => {
...options,
modifiers: [...(options.modifiers || []), monitorable],
}))
updatePopper()
updatePopper(false)
}
onMounted(() => {