Commit d0b9a922 by 李嘉林

商品列表轮播改参数

parent c3ce6cdf
......@@ -223,18 +223,12 @@ const componentOptions = {
this.getInterList(2);
}
}
// 判断是否为滑动组件
if (this.data.datas.componentData.style === 'swipe') {
this.getSwipeLen();
this.getSwipeHeight();
}
},
handleSwipeChange(e) {
this.setData({ currentSwiperIndex: e.detail.current })
},
getSwipeLen() {
const goodsListLen = this.data.datas.componentData.goodsList.length || 0;
const goodsListLen = this.data.pageGoodsList[this.data.datasIndex].length || 0;
const len = Math.ceil((goodsListLen / this.data.datas.componentData.columnNum));
const result = [];
for (let i = 0; i < len; i++) {
......@@ -244,7 +238,7 @@ const componentOptions = {
this.setData({ swipeInfo: result });
},
getSwipeItemLen(index) {
const goodsListLen = this.data.datas.componentData.goodsList.length || 0;
const goodsListLen = this.data.pageGoodsList[this.data.datasIndex].length || 0;
const columnNum = this.data.datas.componentData.columnNum;
const total = (index + 1) * columnNum;
return total > goodsListLen ? goodsListLen - (index * columnNum) : columnNum
......@@ -507,7 +501,12 @@ const componentOptions = {
this.selectComponent("#waterfallFlow").reLoadPro(list);
}
}
})
});
// 判断是否为滑动组件
if (this.data.datas.componentData.style === 'swipe') {
this.getSwipeLen();
this.getSwipeHeight();
}
});
},
......
......@@ -154,13 +154,13 @@
<!-- 轮播滑动 -->
<view wx:if="{{datas.componentData.style === 'swipe' && datas.componentData.goodsList.length > 0}}" style="position:relative;">
<swiper bindchange="handleSwipeChange" style="height: {{swiperHeight}}px">
<block wx:for="{{swipeInfo}}">
<block wx:for="{{swipeInfo}}" wx:key="index">
<swiper-item>
<view class="goods-item" style="display: grid;gap:{{datas.componentData.proGap*2}}rpx;grid-template-columns:repeat({{datas.componentData.columnNum}}, 1fr)">
<view wx:for="{{item}}" wx:for-index="indey" style="display:flex;">
<view wx:for="{{item}}" wx:key="indey" wx:for-index="indey" style="display:flex;">
<goods-item
datas="{{datas}}"
items="{{datas.componentData.goodsList[index * datas.componentData.columnNum + indey]}}"
items="{{pageGoodsList[datasIndex][index * datas.componentData.columnNum + indey]}}"
indexs="{{index}}"
></goods-item>
</view>
......@@ -169,7 +169,7 @@
</block>
</swiper>
<view class="flex custom-indicator" wx:if="{{swiperHeight > 0}}">
<block wx:for="{{swipeInfo}}">
<block wx:for="{{swipeInfo}}" wx:key="index">
<view class="custom-indicator__item {{currentSwiperIndex === index && 'custom-indicator__active'}}"></view>
</block>
</view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment