mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Popover): should update location after transition (#11568)
* fix(popover): location update * fix(popover): update
This commit is contained in:
parent
a21833f973
commit
9cbb2f56fa
@ -17,6 +17,7 @@ import { Instance, createPopper, offsetModifier } from '@vant/popperjs';
|
||||
import {
|
||||
pick,
|
||||
extend,
|
||||
inBrowser,
|
||||
truthProp,
|
||||
numericProp,
|
||||
unknownProp,
|
||||
@ -137,6 +138,10 @@ export default defineComponent({
|
||||
|
||||
if (!popper) {
|
||||
popper = createPopperInstance();
|
||||
if (inBrowser) {
|
||||
window.addEventListener('animationend', updateLocation);
|
||||
window.addEventListener('transitionend', updateLocation);
|
||||
}
|
||||
} else {
|
||||
popper.setOptions(getPopoverOptions());
|
||||
}
|
||||
@ -217,6 +222,10 @@ export default defineComponent({
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (popper) {
|
||||
if (inBrowser) {
|
||||
window.removeEventListener('animationend', updateLocation);
|
||||
window.removeEventListener('transitionend', updateLocation);
|
||||
}
|
||||
popper.destroy();
|
||||
popper = null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user