微信小程序上拉加载更多上拉刷新组件
<scroll-view class="scroll_container " scroll-y="true" style="position:absolute; height:70%;bottom:0; width:100%; bindscroll="scroll" bindscrolltolower="lower" bindscrolltoupper="upper" bindtouchstart="start" bindtouchend="end" >
<view style="width:100%;height:100%" bindtouchmove="move">
<block wx:for="{{words}}">
<view >{{item.username}}</view>
</block>
</view>
var register = require('../../component/scroll/scroll.js');
register.register(this);
@import '../../component/scroll/scroll.wxss';
refresh: function () { this.setData({ page: 1, words: [] }) this.doLoadData(); } 说明: page:设置当前页为1 words:设置为[] doLoadData:为初始化数据方法
loadMore: function () { var page = this.data.page; this.setData({ page: ++page }) this.doLoadData(); } 说明:设置当前页+1,然后初始化数据
加入 register.loadFinish(this, true);