loadMore() {
this.page++
if(this.upLoading) {
$.ajax({
type: 'GET',
url: "intern_list",
data:{
limit:10,
page:this.page
},
dataType: 'json',
success: (res)=> {
if(res.code === 200){
if(res.msg.intern_list.length > 0) {
this.upLoading = true;
let dataList = this.interns;
for (let i = 0; i < res.msg.intern_list.length; i++) {
dataList.push(res.msg.intern_list[i])
}
this.interns = dataList;
}else {
this.upLoading = false;
this.isload = true
}
}
}
})
}
else{
this.isload = true
}
},
scrool(){
window.onscroll = ()=>{
// scrollTop 滚动条滚动时,距离顶部的距离
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
// windowHeight 可视区的高度
var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
// scrollHeight 滚动条的总高度
var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
// 滚动条到底部的条件
if(scrollTop + windowHeight == scrollHeight){
// 加载数据
this.loadMore();
}
}
},