hide popovers on scroll

This commit is contained in:
Henry Jameson 2022-06-08 03:22:15 +03:00
parent 832d7f2354
commit e3b9c00d5e
1 changed files with 5 additions and 0 deletions

View File

@ -168,6 +168,9 @@ const Popover = {
if (this.hidden) return
if (this.$el.contains(e.target)) return
this.hidePopover()
},
onScroll () {
this.hidePopover()
}
},
updated () {
@ -183,9 +186,11 @@ const Popover = {
},
created () {
document.addEventListener('click', this.onClickOutside)
window.addEventListener('scroll', this.onScroll)
},
unmounted () {
document.removeEventListener('click', this.onClickOutside)
window.removeEventListener('scroll', this.onScroll)
this.hidePopover()
}
}