微信小程序--上拉加载

版权声明:本文为博主原创文章,未经博主允许不得转载。如有转载请留言,谢谢~ https://blog.csdn.net/qq_38209578/article/details/86598311

本文只要介绍微信小程序如何实现上拉加载

index.wxml代码如下:

<scroll-view scroll-y style="height:100vh;" bindscrolltolower="lower" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}">
  <view class='content-wrapper' upper-threshold>
	//此处为上拉加载的类别页样式
  </view>
</scroll-view>

注:style="height:100vh;"表示监听当前视窗区域,超出当前的可视区域即触发bindscrolltolower="lower"
index.js代码如下:

 lower: function (e) { // 上拉加载
    console.log(e)
    //此处为上拉加载请求代码
  },

Tips:如果开发中需要多层scroll-view滚动,scroll-view会出现滑动穿透,这时候bindscrolltolower可以改为catchtouchmove即可。

猜你喜欢

转载自blog.csdn.net/qq_38209578/article/details/86598311