<template>
|
<view class="product-list">
|
<view class="product-grid">
|
<view v-for="(item, index) in productList" :key="index" class="product-card">
|
<image class="product-image" :src="item.image" mode="aspectFill"></image>
|
<view class="product-info">
|
<text class="product-title">{{item.title}}</text>
|
<view class="product-price-row">
|
<text class="product-price">¥{{item.price}}</text>
|
<text class="product-original-price">¥{{item.originalPrice}}</text>
|
<text class="product-sales">已售{{item.sales}}件</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
productList: [
|
{
|
image: 'http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960',
|
title: '商品标题1',
|
price: '99.00',
|
originalPrice: '199.00',
|
sales: 1000
|
},
|
{
|
image: 'http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960',
|
title: '商品标题2',
|
price: '88.00',
|
originalPrice: '188.00',
|
sales: 800
|
},
|
// 可以添加更多商品数据
|
]
|
}
|
},
|
onLoad() {
|
// 这里可以添加获取商品列表数据的逻辑
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.product-list {
|
padding: 20rpx;
|
background-color: #f5f5f5;
|
min-height: 100vh;
|
}
|
|
.product-grid {
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
}
|
|
.product-card {
|
width: 48%;
|
margin-bottom: 20rpx;
|
background-color: #ffffff;
|
border-radius: 12rpx;
|
overflow: hidden;
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
}
|
|
.product-image {
|
width: 100%;
|
height: 300rpx;
|
}
|
|
.product-info {
|
padding: 16rpx;
|
}
|
|
.product-title {
|
font-size: 28rpx;
|
color: #333333;
|
margin-bottom: 12rpx;
|
display: -webkit-box;
|
-webkit-box-orient: vertical;
|
-webkit-line-clamp: 2;
|
overflow: hidden;
|
}
|
|
.product-price-row {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
}
|
|
.product-price {
|
font-size: 32rpx;
|
color: #ff4d4f;
|
font-weight: bold;
|
}
|
|
.product-original-price {
|
font-size: 24rpx;
|
color: #999999;
|
text-decoration: line-through;
|
}
|
|
.product-sales {
|
font-size: 24rpx;
|
color: #999999;
|
}
|
</style>
|