監聽scroll 事件 ,滾動換頁搜尋
阿新 • • 發佈:2019-08-25
let scope=this
document.addEventListener('scroll', ()=> {
$('.el-table__body-wrapper').on('scroll',function(){
scope.getScrollState();
})
},true)
//滾動換頁搜尋
getScrollState: function(scope) {
// debugger
var tableListDom = document.getElementsByClassName('searchCLDYTable')[0].getElementsByClassName("el-table__body-wrapper")[1];
var topheight = tableListDom.scrollHeight - tableListDom.offsetHeight - 10;
var scrollHeight = tableListDom.scrollTop;
if (topheight < scrollHeight&&this.isNotLoading) {
this.isNotLoading=false
this.pageIndex = this.pageIndex + 1;
var a = Math.ceil(this.totalNum / this.pageSize);//總條數,每頁數量
if (a >= this.pageIndex) {
this.searchPartFn();
}
}
},