1. loadMore() {
    2. this.page++
    3. if(this.upLoading) {
    4. $.ajax({
    5. type: 'GET',
    6. url: "intern_list",
    7. data:{
    8. limit:10,
    9. page:this.page
    10. },
    11. dataType: 'json',
    12. success: (res)=> {
    13. if(res.code === 200){
    14. if(res.msg.intern_list.length > 0) {
    15. this.upLoading = true;
    16. let dataList = this.interns;
    17. for (let i = 0; i < res.msg.intern_list.length; i++) {
    18. dataList.push(res.msg.intern_list[i])
    19. }
    20. this.interns = dataList;
    21. }else {
    22. this.upLoading = false;
    23. this.isload = true
    24. }
    25. }
    26. }
    27. })
    28. }
    29. else{
    30. this.isload = true
    31. }
    32. },
    1. scrool(){
    2. window.onscroll = ()=>{
    3. // scrollTop 滚动条滚动时,距离顶部的距离
    4. var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    5. // windowHeight 可视区的高度
    6. var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
    7. // scrollHeight 滚动条的总高度
    8. var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
    9. // 滚动条到底部的条件
    10. if(scrollTop + windowHeight == scrollHeight){
    11. // 加载数据
    12. this.loadMore();
    13. }
    14. }
    15. },