mounted() { 监听滚动条 this.$refs.scrollbar.wrap.addEventListener("scroll", this.scrollContent,true) }, scrollContent(e){ let poor=e.target.scrollHeight - e.target.clientHeight if( poor == parseInt(e.target.scrollTop) || poor == Math.ceil(e.target.scrollTop) || poor == Math.floor(e.target.scrollTop) ){ 防止多次滚动加载 this.isLoading?'':this.addPage() }
}, getList(){ let params={ isPage:1, currentPage:this.currentPage, pageSize:50, companyId:this.searchform.companyId, code:this.searchform.code, } this.$http.get(maintainRecord.findMaintainOrderList, params) .then(response => { // console.log(this.maintainList,response.list) // this.maintainList.push(response.list) this.maintainList=[...this.maintainList,...response.list] this.searchform.total = response.total this.$forceUpdate() this.$nextTick(()=>{ this.isLoading=false }) // this.clickedIndex = null // this.clickedWorkIndex = null // this.workList = [] // this.workForm = {} // this.logForm = {} // this.goodsList = [] // this.contentsList = [] }) }, addPage(){ this.isLoading=true if(this.searchform.currentPage*this.searchform.pageSize<this.searchform.total){ this.currentPage=this.currentPage+1 this.getList() }else{ this.isLoading=false } }, 标签:el,maintainList,searchform,target,scrollbar,isLoading,currentPage,response,加载 From: https://www.cnblogs.com/caiguanzheng/p/17074414.html