forked from AkkomaGang/admin-fe
Fix on scroll event
This commit is contained in:
parent
7b4184cbde
commit
93866e78ae
1 changed files with 10 additions and 8 deletions
|
@ -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')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue