rewrite tab swiper 8.7

This commit is contained in:
2020-08-07 17:34:59 +08:00
parent f4ba942870
commit 9d3f8da629
8 changed files with 153 additions and 92 deletions

View File

@@ -5,7 +5,7 @@
</view>
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom">
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom" class="order-scroll">
<view>
<view class="item-container" v-for="order in orderList" :key="order.order_id">
<OrderItem :order="order" @refreshOrderList="refreshOrderList" v-if="current != 4"></OrderItem>
@@ -13,7 +13,7 @@
</view>
</view>
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="current != 4 && orderList.length>3" class="order-loadmore"></u-loadmore>
</scroll-view>
</swiper-item>
</swiper>
@@ -162,8 +162,7 @@ export default {
return res.data.list.length;
},
reachBottom() {
// 大于15条才会加载更多
if(this.orderList.length < 15) return false;
if(this.current == 4) return;
if(!this.timer) return false;
this.timer = false;
this.loadStatus.splice(this.current, 1, "loading");
@@ -171,8 +170,8 @@ export default {
let promise;
// if(this.current == 6) promise = this.getAfterSaleList();
// else
if(this.current == 4) promise = this.goodsTryOrderList();
else promise = this.getOrderList();
// if(this.current == 4) promise = this.goodsTryOrderList();
promise = this.getOrderList();
promise.then(length => {
this.loadStatus.splice(this.current, 1, "nomore");
if(length == 0) this.page--;
@@ -204,8 +203,10 @@ export default {
display: flex;
flex-direction: column;
.swiper-item {
.item-container {
padding: 20rpx 30rpx;
.order-scroll {
.item-container {
padding: 20rpx 30rpx;
}
}
}
}