vue 无限滚动

window.addEventListener('scroll',this.listscroll)

 

listscroll(){
  var contantheight=document.body.scrollHeight //正文高度
  var scrollheight=window.screen.availHeight+document.documentElement.scrollTop || document.body.scrollTop //可视工作区域加滚动卷去的高度
  if(scrollheight>=contantheight){
    var addlist=this.list
    for(let i=0;i<=5;i++){
      this.list.push(addlist[i])
    }
  }
},

posted @ 2021-11-11 15:09  谎渊  阅读(65)  评论(0)    收藏  举报