window.addEventListener('resize', () => {
this.bindingScrollEvent()
this.getTableHeight()
})
...
...
// 回到列表顶部
backTop () {
this.$refs.taskTable.bodyWrapper.scrollTop = 0
},
// 监听滚动事件()
bindingScrollEvent () {
let tableBodyEle = this.$refs.taskTable.bodyWrapper
tableBodyEle.addEventListener('scroll', () => {
if (tableBodyEle.scrollHeight - tableBodyEle.scrollTop - tableBodyEle.clientHeight < 10 && this.currentPage <= this.pageCount) {
tableBodyEle.scrollTop = tableBodyEle.scrollTop > 20 ? tableBodyEle.scrollTop - 20 : 0
this.$emit('loadMore', {
page: this.currentPage,
key: this.keyword,
projectNames: this.projectFilter.data,
statusList: this.stateFilter.data,
taskNames: this.jobNameFilter.data
})
console.log('loadMore, current page: ' + this.currentPage)
this.currentPage++
}
})
},
滚动加载解决el-table是数据量大加载缓慢的问题
最新推荐文章于 2025-03-27 14:46:53 发布