store 8.5
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<view class="list">
|
||||
<view class="top">商品推荐</view>
|
||||
<view>
|
||||
<u-tabs-swiper ref="uTabs" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="60" ></u-tabs-swiper>
|
||||
<u-tabs-swiper ref="uTabs" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="60"></u-tabs-swiper>
|
||||
</view>
|
||||
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" :style="{height: swiperHeight}">
|
||||
<swiper-item class="swiper-item" v-for="(_, index) in classifyList" :key="index">
|
||||
@@ -39,6 +39,7 @@ export default {
|
||||
watch: {
|
||||
current(index) {
|
||||
this.page = 1;
|
||||
this.goodsList = [];
|
||||
const id = this.classifyList[index].gc_id;
|
||||
this.getGoodsRecommend({gc_id: id});
|
||||
}
|
||||
@@ -68,7 +69,7 @@ export default {
|
||||
this.page--;
|
||||
})
|
||||
},
|
||||
getGoodsClassRecommend(gc_id) {
|
||||
getGoodsClassRecommend() {
|
||||
this.$u.api.getGoodsClassRecommend().then(res => {
|
||||
if (res.errCode == 0) {
|
||||
// 初始化 current
|
||||
@@ -82,6 +83,7 @@ export default {
|
||||
page: page,
|
||||
gc_id: gc_id,
|
||||
})
|
||||
// this.swiperCurrent = this.current;
|
||||
if (res.errCode == 0) {
|
||||
this.timer = true;
|
||||
if(reload) this.goodsList = res.data.goodsList;
|
||||
@@ -93,13 +95,14 @@ export default {
|
||||
},
|
||||
setSwiperHeight() {
|
||||
// height: 230px, margin-bottom: 13
|
||||
// const height = Math.ceil(this.goodsList.length / 2) * (510 + 26);
|
||||
// this.swiperHeight = height == 0 ? '230rpx' : height + 'rpx';
|
||||
this.swiperHeight = Math.ceil(this.goodsList.length / 2) * (270 + 13) + 'px';
|
||||
const height = Math.ceil(this.goodsList.length / 2) * (540 + 26);
|
||||
this.swiperHeight = height == 0 ? '230rpx' : height + 'rpx';
|
||||
// this.swiperHeight = Math.ceil(this.goodsList.length / 2) * (270 + 13) + 'px';
|
||||
},
|
||||
// tabs通知swiper切换
|
||||
tabsChange(index) {
|
||||
this.swiperCurrent = index;
|
||||
this.current = index;
|
||||
// this.getGoodsRecommend({ gc_id: this.classifyList[this.current].gc_id });
|
||||
},
|
||||
// swiper-item左右移动,通知tabs的滑块跟随移动
|
||||
transition(e) {
|
||||
@@ -111,8 +114,9 @@ export default {
|
||||
animationfinish(e) {
|
||||
let current = e.detail.current;
|
||||
this.$refs.uTabs.setFinishCurrent(current);
|
||||
this.swiperCurrent = current;
|
||||
this.current = current;
|
||||
this.swiperCurrent = current;
|
||||
// this.getGoodsRecommend({ gc_id: this.classifyList[this.current].gc_id });
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user