修改易购页面选择规格按钮的逻辑错误

This commit is contained in:
赵毅 2025-09-06 10:09:44 +08:00
parent 2a69930eaa
commit b70b3a40df

View File

@ -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,17 +338,22 @@ export default {
this.topShow = !this.topShow;
},
//
chooseGG(targetItems) {
// tagList""1
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);
if (infoIndex > -1) {
//
const currentItem = tagItem.commodity_info_list[infoIndex];
this.$set(currentItem, 'isShow', !currentItem.isShow);
console.log("修改后数据源中的isShow:", currentItem.isShow);
break;
chooseGG(item,targetItems) {
// id
if (item && targetItems && item.id) {
for (let i = 1; i < this.tagList.length; i++) {
const tagItem = this.tagList[i];
// item.idtagItem
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];
this.$set(currentItem, 'isShow', !currentItem.isShow);
console.log("修改后数据源中的isShow:", currentItem.isShow);
break;
}
}
}
}
},