hide popovers on scroll

This commit is contained in:
Henry Jameson 2022-06-08 03:22:15 +03:00
parent 832d7f2354
commit e3b9c00d5e

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()
}
}