The small program scroll-view pulls down to refresh and pulls up to bottom

structure

js 

 

 

When we pull down, we need to get the data again. At this time, when it succeeds, we need to close the pull down to refresh

getVideoList:function(vid){

  wx.showLoading({
    title: '正在加载',
  });
  this.setData({
    vList:""
  })
  // 获取当前vid 下的视频列表
  wx.request({
    url: 'http://localhost:3000/video/group?id='+vid,
    header: {
      'cookie': wx.getStorageSync('cookie')// 默认值
    },
    success:(res)=>{
      console.log(res.data.datas)
      // 取消加载图标
      wx.hideLoading();
      let datas = res.data.datas;
      console.log("data" + datas)
      let index= 0;
    datas = datas.map(item=>{
        item.id = index++;
        return item;
      })
      this.setData({
        vList:datas,
        isTriggered: false
      })
    },
    fail:function(e){
      console.log(e)
    }
  })
},

 

The focus is on the yellow area!

1. Pull-up bottoms out:

Guess you like

Origin blog.csdn.net/qq_15009739/article/details/113072049