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 {