mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(popper): re-create popper if destroyed when updating (#385)
This commit is contained in:
committed by
GitHub
parent
c5042f6d4c
commit
bd2d9b44dc
@@ -160,6 +160,14 @@ export default function (props: IPopperOptions, { emit }: SetupContext<string[]>
|
||||
onBlur?: (e: Event) => void
|
||||
}
|
||||
|
||||
function update() {
|
||||
if (popperInstance) {
|
||||
popperInstance.update()
|
||||
} else {
|
||||
initializePopper()
|
||||
}
|
||||
}
|
||||
|
||||
if (!isManualMode()) {
|
||||
const toggleState = () => {
|
||||
if (visibility.value) {
|
||||
@@ -236,18 +244,10 @@ export default function (props: IPopperOptions, { emit }: SetupContext<string[]>
|
||||
popperInstance.update()
|
||||
})
|
||||
|
||||
watch(visibility, () => {
|
||||
if (popperInstance) {
|
||||
popperInstance.update()
|
||||
} else {
|
||||
initializePopper()
|
||||
}
|
||||
})
|
||||
watch(visibility, update)
|
||||
|
||||
return {
|
||||
update() {
|
||||
popperInstance.update()
|
||||
},
|
||||
update,
|
||||
doDestroy,
|
||||
show,
|
||||
hide,
|
||||
|
||||
Reference in New Issue
Block a user