fix(popper): re-create popper if destroyed when updating (#385)

This commit is contained in:
Enguerrand des Vaux
2020-10-03 14:35:26 +02:00
committed by GitHub
parent c5042f6d4c
commit bd2d9b44dc

View File

@@ -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,