From 0340c3b67c5b676b80fa56d64e6229111614e9f1 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Mon, 22 Dec 2025 14:42:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diy-components/diy-category-item.vue | 52 ++++++++++++++++--- components/diy-components/diy-category.vue | 18 +++++-- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/components/diy-components/diy-category-item.vue b/components/diy-components/diy-category-item.vue index 4564cef..2088a53 100644 --- a/components/diy-components/diy-category-item.vue +++ b/components/diy-components/diy-category-item.vue @@ -64,7 +64,7 @@ {{ category.category_name }} - + @@ -150,7 +150,7 @@ - + @@ -253,6 +253,10 @@ last: { type: Boolean, default: false + }, + isList: { + type: Boolean, + default: false } }, data() { @@ -807,15 +811,11 @@ .goods-item { display: flex; flex-direction: column; - width: calc(50% - 10rpx); border-radius: $border-radius; overflow: hidden; background-color: #fff; margin-bottom: 20rpx; - &:nth-child(2n + 2) { - margin-right: 0; - } - + .goods-img { position: relative; overflow: hidden; @@ -948,6 +948,44 @@ } } } + + /* 双列布局 */ + &.double-column { + .goods-item { + width: calc(50% - 10rpx); + } + } + + /* 单列布局 */ + &.single-column { + flex-direction: column; + .goods-item { + width: 100%; + flex-direction: row; + align-items: center; + + .goods-img { + width: 180rpx; + height: 180rpx; + padding-top: 0; + margin-right: 14rpx; + border-radius: $border-radius; + + image { + border-radius: $border-radius; + } + } + + .goods-name { + white-space: normal; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } + } + } /**/ /*.goods-item { padding: 0 0 26rpx 0; diff --git a/components/diy-components/diy-category.vue b/components/diy-components/diy-category.vue index 7836927..002db0f 100644 --- a/components/diy-components/diy-category.vue +++ b/components/diy-components/diy-category.vue @@ -18,6 +18,7 @@ + @@ -27,6 +28,7 @@ + @@ -84,7 +86,7 @@ @refresherrestore="onRestore"> @@ -97,7 +99,7 @@ :id="'category-' + index" :style="{ display: select == index ? 'block' : 'none' }"> @@ -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; + }, } }; @@ -662,6 +668,12 @@ text-align: center; } } + + // 切换列表图标 + .iconfont { + font-size: 36rpx; + margin: 0 0rpx 0 20rpx; + } } .cart-box {