<scroll-view
scroll-y style="width: 100%; height: 400px;"
refresher-enabled="{{true}}"
refresher-threshold="{{100}}"
refresher-default-style="white"
refresher-background="lightgreen"
refresher-triggered="{{triggered}}"
bindrefresherpulling="onPulling"
bindrefresherrefresh="onRefresh"
bindrefresherrestore="onRestore"
bindrefresherabort="onAbort"
>
</scroll-view>
js
const app = getApp()
Page({
data: {
arr: [],
triggered: false,
},
onReady: function () {
},
onPulling(e) {
console.log('onPulling:', e)
},
onRefresh() {
//模拟发送请求
setTimeout(() => {
this.setData({
triggered: false,
})
}, 3000)
},
onRestore(e) {
console.log('onRestore:', e)
},
onAbort(e) {
console.log('onAbort', e)
},
})
/**index.wxss**/
.intro {
margin: 30px;
text-align: center;
}
.trans {
transition: .2s;
}