feat: 支持商品列表样式切换

This commit is contained in:
2025-12-22 14:42:11 +08:00
parent 8cc804bc6b
commit 0340c3b67c
2 changed files with 60 additions and 10 deletions

View File

@@ -18,6 +18,7 @@
<input type="text" class="uni-input" maxlength="50" :placeholder="$lang('search')" confirm-type="search" disabled="true" />
<text class="iconfont icon-sousuo3"></text>
</view>
<view class="iconfont" :class="{ 'icon-apps': !isList, 'icon-list': isList }" @click="changeListStyle()"></view>
</view>
</block>
<!-- #endif -->
@@ -27,6 +28,7 @@
<input type="text" class="uni-input" maxlength="50" :placeholder="$lang('search')" confirm-type="search" disabled="true" />
<text class="iconfont icon-sousuo3"></text>
</view>
<view class="iconfont" :class="{ 'icon-apps': !isList, 'icon-list': isList }" @click="changeListStyle()"></view>
</view>
<!-- #endif -->
<view class="template-four wx" v-if="value.template == 4">
@@ -84,7 +86,7 @@
@refresherrestore="onRestore">
<view class="child-category" v-for="(item, index) in categoryTree" :key="index" :id="'category-' + index">
<diy-category-item :category="item" :value="value" ref="categoryItem" :index="index"
:select="select" :oneCategorySelect="oneCategorySelect" @tologin="toLogin"
:select="select" :oneCategorySelect="oneCategorySelect" :isList="isList" @tologin="toLogin"
@selectsku="selectSku($event, index)" @addCart="addCartPoint"
@loadfinish="getHeightArea"></diy-category-item>
</view>
@@ -97,7 +99,7 @@
:id="'category-' + index" :style="{ display: select == index ? 'block' : 'none' }">
<diy-category-item :category="item" :value="value" ref="categoryItem" :index="index"
:last="index == categoryTree.length - 1 ? true : false" :select="select"
:oneCategorySelect="oneCategorySelect" @tologin="toLogin"
:oneCategorySelect="oneCategorySelect" :isList="isList" @tologin="toLogin"
@selectsku="selectSku($event, index)" @addCart="addCartPoint"
@switch="switchOneCategory"></diy-category-item>
</view>
@@ -176,6 +178,7 @@
cartAnimation: {},
loadType: '',
templateFourData: [],
isList: false,
lang:uni.getStorageSync("lang")//en-us 英文
};
},
@@ -521,7 +524,10 @@
// 操作多规格商品弹框后,刷新商品数据
refreshData() {
this.$refs.categoryItem[this.select].loadGoodsCartNum(true);
}
},
changeListStyle() {
this.isList = !this.isList;
},
}
};
</script>
@@ -662,6 +668,12 @@
text-align: center;
}
}
// 切换列表图标
.iconfont {
font-size: 36rpx;
margin: 0 0rpx 0 20rpx;
}
}
.cart-box {