Vue~~判断滚动条是否滚动至最底部
原创
©著作权归作者所有:来自51CTO博客作者爱笑嘚蛋蛋的原创作品,请联系作者获取转载授权,否则将追究法律责任
mounted() {
window.addEventListener("scroll", this.handleScroll);
}
methods: {
handleScroll() {
const scrollTop =
document.documentElement.scrollTop || document.body.scrollTop;
const scrollHeight =
document.documentElement.scrollHeight || document.body.scrollHeight;
const clientHeight =
document.documentElement.clientHeight || window.innerHeight;
if (scrollTop + clientHeight >= scrollHeight) {
if (this.page.current < this.page.totalPages) {
this.page.loading = true;
this.handleRefresh(this.page.current);
}
}
},
}