Преглед изворни кода

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
优惠券bug修改

1004749546@qq.com пре 4 година
родитељ
комит
7eebfe9bd3
1 измењених фајлова са 9 додато и 4 уклоњено
  1. 9 4
      pages/coupon/index/index.vue

+ 9 - 4
pages/coupon/index/index.vue

@@ -4,7 +4,7 @@
 			<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" @animationfinish="animationfinish">
+		<swiper style="height: calc(100% - 40px);" :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>
@@ -57,6 +57,7 @@
 				this.swiperCurrent = 0
 				this.count = 0
 				this.couponList = []
+				this.status = 'loading'
 				this.getList()
 			},
 			// tabs通知swiper切换
@@ -64,12 +65,19 @@
 				this.swiperCurrent = index;
 				this.couponList = []
 				this.count = 0
+				this.status = 'loading'
 			},
 			// swiper-item左右移动,通知tabs的滑块跟随移动
 			transition(e) {
 				let dx = e.detail.dx;
 				this.$refs.uTabs.setDx(dx);
 			},
+			swiperChange(event){
+				console.log(event.detail)
+				this.couponList = []
+				this.count = 0
+				this.status = 'loading'
+			},
 			// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
 			// swiper滑动结束,分别设置tabs和swiper的状态
 			animationfinish(e) {
@@ -77,13 +85,10 @@
 				this.$refs.uTabs.setFinishCurrent(current);
 				this.swiperCurrent = current;
 				this.current = current;
-				this.couponList = []
-				this.count = 0
 				this.getList()
 			},
 			// 获取优惠卷列表
 			getList(){
-				this.status = 'loading'
 				let item = this.tabsList[this.swiperCurrent]
 				let params = {
 					pageNo: this.pageNo,