betterscroll上拉加载

 mounted(){
      var that=this;
      setTimeout(()=>{
        let scroll = new BScroll(document.getElementById('wrapper'),{
          probeType: 1
        })

        scroll.on('scroll', (pos) => {
          // console.log(pos.x + '~' + posx.y)
        });
        // 滑动结束

        scroll.on('touchend', function (position) {
          if(position.y < (this.maxScrollY - 30)) {
            alert('加载中')
            setTimeout(function () {
              // 恢复文本值
              alert('加载更多')
              // 向列表添加数据
              //reloadData();
              that.loadRank(that.currentPage + 1);
              // 加载更多后,重新计算滚动区域高度
              scroll.refresh();
            }, 1000);
          }
        });
      },200)
    },

  

猜你喜欢

转载自www.cnblogs.com/holy-amy/p/9429224.html