Commit cab05b61 by 李嘉林

优化

parent d0b9a922
......@@ -71,7 +71,7 @@
>
<div v-for="(item1, index1) in item.contentList" :key="index1">
<embed-module v-if="item1.componentCode == 'embed-module'" :datas="item1" :componentIndex="componentIndex" :active="active" :goodsListIndex="index" :index1="index1"></embed-module>
<componentsGroup :item1="item1" :index1="index1" :componentIndex="componentIndex" :active="active" :goodsListIndex="index" :storageKey="'transverse-label'+componentIndex" v-else></componentsGroup>
<componentsGroup :item1="item1" :index1="index1" :componentIndex="componentIndex" :active="active" :tabIndex="index" :goodsListIndex="index1" :storageKey="'transverse-label'+componentIndex" v-else></componentsGroup>
</div>
</van-tab>
</van-tabs>
......
......@@ -6,10 +6,9 @@
<banner :datas="item1"></banner>
</div>
<div v-else-if="item1.componentCode == 'goods-list' && item1.componentInfo.visible == 1" style="height:100%;">
<goods-list :storageKey="storageKey"
:class="['goodsListItemIndex' + index1, 'transverse-label-goodsListItem']" :datas="item1" :datasIndex="active"
:goodsListIndex="goodsListIndex"></goods-list>
:goodsListIndex="goodsListIndex" :tabIndex="index"></goods-list>
</div>
<div v-else-if="item1.componentCode == 'ranking-list' && item1.componentInfo.visible == 1">
......@@ -135,6 +134,10 @@ export default {
type: Number,
default: 0,
},
tabIndex: {
type: Number,
default: 0,
},
},
data() {
return {}
......
......@@ -21,10 +21,12 @@ const componentOptions = {
datas: {
type: Object
},
// 父级组件index (横向标签为tab索引,没有为0)
datasIndex:{
type: Number,
default: 0
},
// 同级组件index
goodsListIndex:{
type: Number,
default: 0
......@@ -342,7 +344,7 @@ const componentOptions = {
if (goodsLists && goodsLists.length < query.rows) {
this.setData({ finished: true });
}
this.goodsListVal(goodsList, type);
this.goodsListVal(goodsList, type, true);
}
});
} else {
......@@ -420,7 +422,8 @@ const componentOptions = {
}
});
},
goodsListVal(goodsList, type,flag) {
goodsListVal(goodsList, type, flag) {
console.log('goodsListVal', goodsList, type, flag);
let { attributeValueList } = this.data.datas.componentData;
goodsList.forEach((item, index) => {
item.marketingTag = item.defaultTags
......@@ -478,6 +481,7 @@ const componentOptions = {
pageGoodsList[that.data.datasIndex] = list;
}
this.setStorageSync('pageGoodsList', pageGoodsList);
console.log('goodsListVal->2', that.data.goodsListIndex, that.data.datasIndex, list)
// 获取是否要开启请求拦截
......@@ -486,6 +490,7 @@ const componentOptions = {
this.setStorageSync('loadingFlag', loadingFlag);
that.setData({
"datas.componentData.goodsList": list,
goodsList: list,
pageGoodsList,
loadingFlag,
scrollLoading: false,
......@@ -751,6 +756,7 @@ const componentOptions = {
});
},
setStorageSync(key, val) {
console.log('setStorageSync->', this.data.storageKey, key, val)
return wx.setStorageSync(`${this.data.storageKey}_${key}`,val)
},
getStorageSync(key) {
......
......@@ -130,14 +130,14 @@
style="margin-left:{{-datas.componentData.proGap*2}}rpx;"
>
<view
wx:for="{{pageGoodsList[datasIndex]}}"
wx:for="{{goodsList}}"
wx:key="index"
class="goods-item"
style="width:{{100/datas.componentData.columnNum}}%;padding-left:{{datas.componentData.proGap*2}}rpx;display:flex;"
>
<goods-item
datas="{{datas}}"
items="{{pageGoodsList[datasIndex][index]}}"
items="{{item}}"
indexs="{{index}}"
></goods-item>
</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