瀏覽代碼

bug 修复

lilei 4 年之前
父節點
當前提交
09eef74bee
共有 1 個文件被更改,包括 8 次插入8 次删除
  1. 8 8
      pages/coupon/index/index.vue

+ 8 - 8
pages/coupon/index/index.vue

@@ -4,10 +4,10 @@
 			<u-tabs-swiper ref="uTabs" active-color="red" :list="tabsList" bar-width="100" :current="current" @change="tabsChange" :is-scroll="false"
 			 swiperWidth="750"></u-tabs-swiper>
 		</view>
-		<swiper style="height: calc(100% - 40px);" :current="swiperCurrent" @transition="transition"  @change="swiperChange" @animationfinish="animationfinish">
+		<swiper style="height: calc(100% - 50px);" :current="swiperCurrent" @transition="transition"  @change="swiperChange" @animationfinish="animationfinish">
 			<swiper-item class="swiper-item" v-for="(item, index) in tabsList" :key="index">
 				<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="onreachBottom">
-					<couponTpl :list="couponList"></couponTpl>
+					<couponTpl :list="index==current?couponList:[]"></couponTpl>
 					<u-empty :text="noDataText" img-width="120" v-if="couponList.length==0 && status!='loading'" mode="list"></u-empty>
 					<view style="padding: 20upx;">
 						<u-loadmore v-if="count>pageSize || status=='loading'" :status="status" />
@@ -63,8 +63,6 @@
 			// tabs通知swiper切换
 			tabsChange(index) {
 				this.swiperCurrent = index;
-				this.couponList = []
-				this.status = 'loading'
 			},
 			// swiper-item左右移动,通知tabs的滑块跟随移动
 			transition(e) {
@@ -80,10 +78,12 @@
 			// swiper滑动结束,分别设置tabs和swiper的状态
 			animationfinish(e) {
 				let current = e.detail.current;
-				this.$refs.uTabs.setFinishCurrent(current);
-				this.swiperCurrent = current;
-				this.current = current;
-				this.getList(1)
+				if (current != this.current) {
+					this.$refs.uTabs.setFinishCurrent(current);
+					this.swiperCurrent = current;
+					this.current = current;
+					this.getList()
+				}
 			},
 			// 获取优惠卷列表
 			getList(num){