微信小程序分页实现

方案一:滚动视图绑定bindscrolltolower

<scroll-view scroll-y="true" style="height:{{scrollHeight}}px;"  bindscrolltolower="bindDownLoad" >
    <view wx:for="{{list}}" class='navigator'>
          <view class='waybill_text'>
            <text>姓名:{{item.name}}text> 
            <text>年龄:{{item.age}}text> 
          view>
scroll-view>
onLoad: function (options) {   
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          //获取手机屏幕高度
          scrollHeight: res.windowHeight
        });
      }
    });
  },
 bindDownLoad: function () {
    //下拉到底部绑定事件
    var that = this;
    Getlist(that);
  },
  onPullDownRefresh: function () {
    console.log("下拉刷新");
    let that = this
    refresh(that);
  }

使用下拉刷新onPullDownRefresh,需要在对应的页面JSON文件中配置:

{
    "enablePullDownRefresh": true
}

方案二:使用onReachBottom事件

<view>
    <view wx:for="{{list}}" class='navigator'>
          <view class='waybill_text'>
            <text>姓名:{{item.name}}text> 
            <text>年龄:{{item.age}}text> 
          view>
view> ``` 

onReachBottom:function(){
console.log(“加载到底部了!”);
var that = this;
的GetList(即);
} “`


我在微信订阅号等你!
这里写图片描述

你可能感兴趣的:(微信小程序分页实现)