Skip to content
Snippets Groups Projects
Commit 93866e78 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Fix on scroll event

parent 7b4184cb
No related branches found
No related tags found
1 merge request!11Add ability to read reports
...@@ -31,16 +31,18 @@ export default { ...@@ -31,16 +31,18 @@ export default {
}, },
mounted() { mounted() {
this.$store.dispatch('FetchReports') this.$store.dispatch('FetchReports')
this.scroll(this.reports) },
created() {
window.addEventListener('scroll', this.handleScroll)
},
destroyed() {
window.removeEventListener('scroll', this.handleScroll)
}, },
methods: { methods: {
scroll(reports) { handleScroll(reports) {
window.onscroll = () => { const bottomOfWindow = document.documentElement.scrollHeight - document.documentElement.scrollTop === document.documentElement.clientHeight
const bottomOfWindow = document.documentElement.scrollHeight - document.documentElement.scrollTop === document.documentElement.clientHeight if (bottomOfWindow) {
this.$store.dispatch('FetchReports')
if (bottomOfWindow) {
this.$store.dispatch('FetchReports')
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment