spike time 8.8
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
<template>
|
||||
<view class="group">
|
||||
<view>
|
||||
<u-tabs-swiper ref="uTabs" :list="tabList" name="gc_name" :current="current" @change="tabsChange" :is-scroll="true" active-color="#FF780F" swiperWidth="750" height="88" :show-bar="false"></u-tabs-swiper>
|
||||
<!-- <u-tabs-swiper ref="uTabs" :list="tabList" name="gc_name" :current="current" @change="tabsChange" :is-scroll="true" active-color="#FF780F" swiperWidth="750" height="88" :show-bar="false"></u-tabs-swiper> -->
|
||||
<u-tabs :list="tabList" name="gc_name" :is-scroll="true" :current="current" @change="tabsChange" active-color="#FF780F" :show-bar="false" height="88" font-size="24" inactive-color="#333333"></u-tabs>
|
||||
</view>
|
||||
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" :style="{height: swiperHeight}">
|
||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{height: swiperHeight}">
|
||||
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index">
|
||||
<scroll-view scroll-y style="width: 100%;" @scrolltolower="onreachBottom">
|
||||
<SpecialGoods v-for="(item, index) in pinTuanList" :key="index" :item="item" type='group'></SpecialGoods>
|
||||
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="pinTuanList.length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
|
||||
<u-empty text="暂无商品" mode="list" color="#000" v-if="!pinTuanList.length"></u-empty>
|
||||
<view v-if="pinTuanList[index]">
|
||||
<SpecialGoods v-for="(item, index) in pinTuanList[index]" :key="index" :item="item" type='group'></SpecialGoods>
|
||||
</view>
|
||||
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="!pinTuanList[index] || pinTuanList[index].length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
|
||||
<u-empty text="暂无商品" mode="list" color="#000" v-if="!pinTuanList[index] || !pinTuanList[index].length"></u-empty>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
@@ -47,8 +50,8 @@ export default {
|
||||
async getGoodsClass() {
|
||||
return await this.$u.api.getGoodsClass().then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.tabList = res.data;
|
||||
this.current = 0;
|
||||
this.tabList = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -60,9 +63,10 @@ export default {
|
||||
})
|
||||
this.timer = true;
|
||||
if (res.errCode == 0) {
|
||||
if(load == 'reload') this.pinTuanList = res.data;
|
||||
else if(load == 'loadmore') this.pinTuanList.push(...res.data);
|
||||
if(load == 'reload') this.pinTuanList[this.current] = res.data;
|
||||
else if(load == 'loadmore') this.pinTuanList[this.current].push(...res.data);
|
||||
}
|
||||
this.$forceUpdate();
|
||||
return res.data.length;
|
||||
},
|
||||
// scroll-view到底部加载更多
|
||||
@@ -88,13 +92,9 @@ export default {
|
||||
},
|
||||
// tabs通知swiper切换
|
||||
tabsChange(index) {
|
||||
this.current = index;
|
||||
this.swiperCurrent = index;
|
||||
},
|
||||
// swiper-item左右移动,通知tabs的滑块跟随移动
|
||||
transition(e) {
|
||||
let dx = e.detail.dx;
|
||||
this.$refs.uTabs.setDx(dx);
|
||||
},
|
||||
// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
|
||||
// swiper滑动结束,分别设置tabs和swiper的状态
|
||||
animationfinish(e) {
|
||||
|
||||
Reference in New Issue
Block a user