fix: align overlay dynamically

pull/2037/head
Enoooch 2022-01-21 14:21:50 +08:00
parent b606675dbb
commit 6164ac4601
1 changed files with 2 additions and 1 deletions

View File

@ -97,7 +97,6 @@ export default {
this.visible = false; this.visible = false;
}, },
onEnter(el) { onEnter(el) {
this.alignOverlay();
this.bindOutsideClickListener(); this.bindOutsideClickListener();
this.bindScrollListener(); this.bindScrollListener();
this.bindResizeListener(); this.bindResizeListener();
@ -133,6 +132,8 @@ export default {
this.outsideClickListener = (event) => { this.outsideClickListener = (event) => {
if (this.visible && this.container && !this.container.contains(event.target) && !this.isTargetClicked(event)) { if (this.visible && this.container && !this.container.contains(event.target) && !this.isTargetClicked(event)) {
this.visible = false; this.visible = false;
} else {
this.alignOverlay();
} }
}; };
document.addEventListener('click', this.outsideClickListener); document.addEventListener('click', this.outsideClickListener);