场景: 表格内的数据太多,导致页面太卡,所以初始化先展示100条数据,然后滚动在添加数据
mounted (){
this.$nextTick(() => {
let dom = this.$refs.logTable.bodyWrapper
dom.addEventListener(“scroll”, this.scrollBottom, true)
})
}
scrollBottom () {
let dom = ${.log_main .el-table .el-table_body-wrapper
}
let height = ${“.log_main”}.height() // 获取表格的高度
if(dom.prop(“scrollTop) >= (dom.prop(“scrollHwight”) – height )){
console.log(“触底啦”)
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/282638.html