fix(components): [dialog] fix el-dialog z-index bug (#14373)

* Fix el-dialog z-index bug

* Update packages/components/dialog/src/use-dialog.ts

Co-authored-by: btea <2356281422@qq.com>

* chore: lint error

---------

Co-authored-by: qiang <qw13131wang@gmail.com>
Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
Chen 2023-10-29 21:54:44 +08:00 committed by GitHub
parent 3b27db428b
commit fd5fc8e855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import {
} from 'vue'
import { useTimeoutFn } from '@vueuse/core'
import { isUndefined } from 'lodash'
import {
defaultNamespace,
useId,
@ -35,7 +36,7 @@ export const useDialog = (
const visible = ref(false)
const closed = ref(false)
const rendered = ref(false) // when desctroyOnClose is true, we initialize it as false vise versa
const zIndex = ref(props.zIndex || nextZIndex())
const zIndex = ref(props.zIndex ?? nextZIndex())
let openTimer: (() => void) | undefined = undefined
let closeTimer: (() => void) | undefined = undefined
@ -161,7 +162,7 @@ export const useDialog = (
closed.value = false
open()
rendered.value = true // enables lazy rendering
zIndex.value = props.zIndex ? zIndex.value++ : nextZIndex()
zIndex.value = isUndefined(props.zIndex) ? nextZIndex() : zIndex.value++
// this.$el.addEventListener('scroll', this.updatePopper)
nextTick(() => {
emit('open')