争渡,争渡,惊起一滩鸥鹭

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

<article ref='articleHeight' class="show-list" style="height: calc(100vh - 46px - 38px - 38px)">
          <div ref='listHeight'>
          遍历的内容
          </div>
</div>

 

  mounted () {
    // 上拉加载
    let that = this;
    that.$nextTick(function() {
      that.$refs.articleHeight.addEventListener('scroll',()=>{
        let articleClientHeight = that.$refs.articleHeight.clientHeight;
        let listClientHeight = that.$refs.listHeight.clientHeight;
        let listScrollTop = that.$refs.articleHeight.scrollTop;
        if (that.iscontinue && !that.isPending && articleClientHeight + listScrollTop + 20 >= listClientHeight) {
          that.isPending = true;
          that.getData(that.pageNum+1);
        }
      })
   });
  },

 

  .show-list {
    overflow: auto;
    overflow-y: scroll;
    -Webkit-overflow-scrolling: touch;
  }

 

posted on 2021-07-24 16:45  争渡~  阅读(164)  评论(0)    收藏  举报