Commit cab05b61 by 李嘉林

优化

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