接管控制refresher-triggered做自定义下拉刷新,刷新加载成功后将其置为false,第一次下拉刷新可触发refresherrefresh,动画可以正常结束;在不进行页面上拉滑动时,再次下拉刷新有动画,但是无法触发refresherrefresh。
推测是因为结束刷新后滚动列表已经滚动到顶部,再下拉无法触发滚动导致的,于是尝试手动修改scrollTop,仍无效。
HBuilder version: 3.1.22.20210709
<scroll-view style="height: 100%;" scroll-y :scroll-top="scrollTop" :refresher-threshold='100' refresher-enabled :refresher-triggered="triggered"
@refresherrefresh="onRefresh" @refresherrestore="onRestore">
</scroll-view>
data () {
triggered: false,
refreshing: false
},
methods: {
onRefresh () {
if (this.refreshing) return;
this.refreshing = true;
if (!this.triggered) {
this.triggered = true;
}
setTimeout(() => {
this.triggered = false;
this.refreshing = false;
uni.showToast({
title: '加载完成'
});
}, 1000);
},
onRestore () {
this.triggered = false;
this.scrollTop = 1;
console.log('onRestore');
}
}
0 个回复