better-scroll上啦加载

2019-05-29  本文已影响0人  拾钱运
 createScroller() {
        this.scroller = new BScroll(this.$refs.scroller, {
          click: true,
          probeType: 3,
          pullUpLoad: {
            threshold: 50
          },
           mouseWheel: {    // pc端同样能滑动
            speed: 20,
            invert: false
        },
        useTransition:false  // 防止iphone微信滑动卡顿
        });
        this.scroller.on('pullingUp',()=>{
            console.log('处理加载更多')
            this.hotpage+=1
            this.hots=true;
            //请求接口
            this.gethotdata().then(
            this.$refs.hotG.lazyload()//图片懒加载
            )
            setTimeout(() => {
            // 事情做完,需要调用此方法告诉 better-scroll 数据已加载,否则上拉事件只会执行一次
                this.scroller.finishPullUp()
                // this.scroller.refresh()
                this.hots=false;
            }, 2000)
        })
      },
上一篇 下一篇

猜你喜欢

热点阅读