效果图
- 标题处做了限制两行
- 商品图片高度自适应.不需要就把mode去掉
wxml
<view class="item">
<image class="item_img" mode="widthFix" src="../../../images/a10.png"></image>
<view class="item_right">
<view class="item_name">商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称</view>
<view class="item_bottom">
<text class="item_coin">200积分</text>
<text class="item_btn">立即兑换</text>
</view>
</view>
</view>
wxss
/* item */
.item {
box-sizing: border-box;
background: #fff;
width: 100%;
padding: 10rpx 20rpx;
margin: 20rpx 0;
display: flex;
}
.item_img {
width: 30%;
}
.item_right {
flex: 1;
padding-left: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.item_name {
/* line-clamp: 2;
text-overflow: ellipsis; */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.item_bottom {
display: flex;
justify-content: space-between;
align-items: center;
}
.item_coin {
color: red;
font-size: 24rpx;
}
.item_btn {
background-color: #000;
color: #fff;
border-radius: 20rpx;
padding: 10rpx;
font-size: 24rpx;
}
/* end */