修改易购页面选择规格按钮的逻辑错误
This commit is contained in:
parent
2a69930eaa
commit
b70b3a40df
@ -135,14 +135,14 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="gg" @click="chooseGG(items)" v-if="
|
||||
<view class="gg" @click="chooseGG(item,items)" v-if="
|
||||
items.commodity_goods_info_list.length > 1 && !items.isShow
|
||||
">
|
||||
选择规格
|
||||
<u-icon name="arrow-down" size="26rpx" color="#FF370B"></u-icon>
|
||||
</view>
|
||||
|
||||
<view class="gg" @click="chooseGG(items)" v-if="
|
||||
<view class="gg" @click="chooseGG(item,items)" v-if="
|
||||
items.commodity_goods_info_list.length > 1 && items.isShow
|
||||
">
|
||||
收起
|
||||
@ -338,11 +338,14 @@ export default {
|
||||
this.topShow = !this.topShow;
|
||||
},
|
||||
// 选择商品规格
|
||||
chooseGG(targetItems) {
|
||||
// 遍历tagList找到目标对象(排除"全部"选项,从索引1开始)
|
||||
chooseGG(item,targetItems) {
|
||||
// 根据两个参数的id判断点击的数据
|
||||
if (item && targetItems && item.id) {
|
||||
for (let i = 1; i < this.tagList.length; i++) {
|
||||
const tagItem = this.tagList[i];
|
||||
const infoIndex = tagItem.commodity_info_list.findIndex(item => item.id === targetItems.id);
|
||||
// 先根据item.id找到对应的tagItem
|
||||
if (tagItem.id === item.id) {
|
||||
const infoIndex = tagItem.commodity_info_list.findIndex(infoItem => infoItem.id === targetItems.id);
|
||||
if (infoIndex > -1) {
|
||||
// 直接修改数据源中的对象,确保响应式
|
||||
const currentItem = tagItem.commodity_info_list[infoIndex];
|
||||
@ -351,6 +354,8 @@ export default {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//搜索页
|
||||
searchPage() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user