店铺商品的下拉刷新

This commit is contained in:
THK3121 2023-06-01 09:59:39 +08:00
parent 8dc86cfa53
commit 75e98578c2
2 changed files with 16 additions and 4 deletions

View File

@ -662,8 +662,7 @@
"path": "home/index", "path": "home/index",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "店铺首页", "navigationBarTitleText": "店铺首页"
"enablePullDownRefresh": true
// #ifdef MP // #ifdef MP
, ,
"navigationBarTextStyle": "#FFFFFF" "navigationBarTextStyle": "#FFFFFF"

View File

@ -74,7 +74,7 @@
</view> </view>
</view> </view>
</view> </view>
<scroll-view class="main" scroll-y="true" @scroll="scrollHome" catchtouchmove :style="viewColor"> <scroll-view @refresherrefresh="onRefresh" refresher-enabled="true" :refresher-triggered="isTriggered" class="main" scroll-y="true" @scroll="scrollHome" catchtouchmove :style="viewColor">
<!-- 店铺信息 --> <!-- 店铺信息 -->
<view id="store" class="store"> <view id="store" class="store">
<image :src="store.mer_avatar"></image> <image :src="store.mer_avatar"></image>
@ -496,6 +496,8 @@
}, },
data() { data() {
return { return {
//
isTriggered:false,
domain: HTTP_REQUEST_URL, domain: HTTP_REQUEST_URL,
// #ifdef MP // #ifdef MP
menuButtonInfo: uni.getMenuButtonBoundingClientRect(), menuButtonInfo: uni.getMenuButtonBoundingClientRect(),
@ -1183,7 +1185,18 @@
} }
}, },
//#endif //#endif
onRefresh(){
this.isTriggered = true;
const newList = this.goods.reverse();
this.goods = newList;
this.getProductSpu()
setTimeout(() => {
this.isTriggered = false;
}, 500)
},
}, },
onReachBottom() { onReachBottom() {
// //
if (this.tabActive == 0) { if (this.tabActive == 0) {
@ -1200,7 +1213,7 @@
this.goods = newList; this.goods = newList;
this.getProductSpu() this.getProductSpu()
// uni.startPullDownRefresh(); // uni.startPullDownRefresh();
uni.stopPullDownRefresh(); // uni.stopPullDownRefresh();
}, 500) }, 500)
} }
} }