html部分:
<div
ref="biReportLayout"
@scroll="scroll($event,item)"
>
</div>
js部分:
// 滚动事件
scroll(ev, item) {
const _this = this
if (item.isPage && item.pageSize) { // 是否分页
let scrollTop = this.$refs.biReportLayout.scrollTop
let clientHeight = this.$refs.biReportLayout.clientHeight
let scrollHeight = this.$refs.biReportLayout.scrollHeight
if (scrollTop + clientHeight >= scrollHeight && !this.isScrollLoading) { // 滑到底
this.isScrollLoading = true
if (this.pageSize > this.total) {
return false
} else {
this.pageSize = this.pageSize + 10 //显示条数新增
this.getpageList() //请求列表list 接口方法
}
} else {
return false
}
}
},