recalculate position on scrolls
This commit is contained in:
parent
8979548ed8
commit
85de0927fa
|
@ -195,8 +195,8 @@ const Popover = {
|
||||||
if (this.$el.contains(e.target)) return
|
if (this.$el.contains(e.target)) return
|
||||||
this.hidePopover()
|
this.hidePopover()
|
||||||
},
|
},
|
||||||
onScroll () {
|
onScroll (e) {
|
||||||
this.hidePopover()
|
this.updateStyles()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updated () {
|
updated () {
|
||||||
|
@ -210,13 +210,17 @@ const Popover = {
|
||||||
this.oldSize = { width: content.offsetWidth, height: content.offsetHeight }
|
this.oldSize = { width: content.offsetWidth, height: content.offsetHeight }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
mounted () {
|
||||||
|
let scrollable = this.$refs.trigger.closest('.column.-scrollable')
|
||||||
|
if (!scrollable) scrollable = window
|
||||||
document.addEventListener('click', this.onClickOutside)
|
document.addEventListener('click', this.onClickOutside)
|
||||||
window.addEventListener('scroll', this.onScroll)
|
scrollable.addEventListener('scroll', this.onScroll)
|
||||||
},
|
},
|
||||||
unmounted () {
|
beforeUnmount () {
|
||||||
|
let scrollable = this.$refs.trigger.closest('.column.-scrollable')
|
||||||
|
if (!scrollable) scrollable = window
|
||||||
document.removeEventListener('click', this.onClickOutside)
|
document.removeEventListener('click', this.onClickOutside)
|
||||||
window.removeEventListener('scroll', this.onScroll)
|
scrollable.removeEventListener('scroll', this.onScroll)
|
||||||
this.hidePopover()
|
this.hidePopover()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue