赞
踩
//wxml <view class="container"> <view class="box"> <scroll-view scroll-y style="width:100%;height:400rpx" refresher-enabled="{{true}}" refresher-threshold="{{100}}" refresher-default-style="white" refresher-background="lightgreen" refresher-triggered="{{triggered}}" bindrefresherpulling="onPulling" bindrefresherrefresh="onRefresh" bindrefresherrestore="onRestore" bindrefresherabort="onAbort"> <view>1</view> </scroll-view> </view> </view>
// js Page({ data: { triggered: false }, onLoad: function () { }, onPulling(e) {//下拉中 console.log(e, 'pulling') }, onRefresh(e) {//取消下拉 console.log(e, 'refresh'); if (this._freshing) return//防止重复下拉 this._freshing = true setTimeout(() => {//下拉请求完成 this.setData({ triggered: false, }) this._freshing = false }, 3000) }, onRestore(e) {//复位 console.log(e, 'restore') }, onAbort(e) {//没有下拉到refresher-threshold值 console.log(e, 'abort') } })
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。