<template> <view class="product"> <view @click="itemClick(item)" v-for="(item,index) in list" :key="index" class="product-item"> <view class="product-item-img"> <image style="width: 100%;height: 100%;" :src="item.img" mode=""></image> <view class="product-item-img-icon"> <uni-icons v-if="item.Collect == 0" color="#fff" type="star" size="24"></uni-icons> <uni-icons v-else color="#05CCA1" type="star-filled" size="24"></uni-icons> </view> </view> <view class="product-item-text"> <view class="product-item-text-title"> {{item.title}} </view> <view class="product-item-text-usr"> {{item.user}} </view> <view class="product-item-text-usr"> {{item.date}} </view> <view class="product-item-text-Price"> ¥ <text style="font-size: 36rpx;font-weight: 700;">{{item.Price}}</text> </view> </view> </view> </view> </template> <script> export default { name: "productList", props: { list: { type: Array, default: () => [] } }, data() { return { }; }, mounted() { console.log(this.list) }, methods:{ itemClick(item){ this.$emit('item',item) } } } </script> <style lang="scss" scoped> .product { width: 100%; box-sizing: border-box; display: flex; flex-wrap: wrap; justify-content: space-between; padding: 32rpx 0; .product-item { height: 424rpx; width: 332rpx; border-radius: 5.33px; box-shadow: 0px 0px 6.67px 0px rgba(147, 147, 147, 0.10); background-color: #fff; margin-bottom: 24rpx; overflow: hidden; position: relative; .product-item-img { width: 100%; height: 260rpx; position: relative; .product-item-img-icon { position: absolute; right: 24rpx; top: 24rpx; } } .product-item-text { padding: 14rpx 24rpx 24rpx 24rpx; box-sizing: border-box; .product-item-text-title { font-size: 24rpx; font-weight: 700; } .product-item-text-usr { font-size: 24rpx; color: #999; } .product-item-text-Price { position: absolute; right: 24rpx; bottom: 24rpx; color: #05CCA1; } } } } </style>