scroll (e) {
// const box = document.getElementsByClassName('collection')[0]
const box = this.$refs.collection
// 变量scrollTop是滚动条滚动时,距离顶部的距离
const scrollTop = box.scrollTop
// 变量windowHeight是可视区的高度
const clientHeight = box.clientHeight
// 变量scrollHeight是滚动条的总高度
const scrollHeight = box.scrollHeight
// 滚动条到底部的条件
console.log(scrollHeight ,scrollTop, clientHeight)
if (scrollHeight - scrollTop - 10 <= clientHeight) {
// 写后台加载数据的函数
this.pageNum += 1
this.getCollection(this.pageNum)
}
// }
},
监听元素滚动到底部
最新推荐文章于 2024-03-01 22:00:00 发布