小程序上拉加载

<scroll-view class="scroll-view" scroll-y="{{isscroll}}" bindscrolltolower="scrollTOlower">
		<view wx:for="{{concent}}>
			.......
		</view>
</scroll-view>		

小程序上拉加载_第1张图片

可参考 https://developers.weixin.qq.com/miniprogram/dev/component/scroll-view.html

scrollTOlower(e) {
      let page = this.data.page + 1
      this.setData({
        page: page
      })
      app.req('GET', '后台接口地址', res => {//请求接口
        if (res.data && res.data.meta.status_code === 200) {
          let oldList = this.data.itemList //之前数据
          let list = oldList.concat(res.data.data)//拼接之前数据
          this.setData({
            itemList: list //返回新数据
          })
        }
      }, {
          page: page,//当前页
          pagesize: 10 //每页显示几条数据
        })
  },

你可能感兴趣的:(小程序上拉加载)