good-list.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!-- 商品列表组件 <good-list :list="xx"></good-list> -->
  2. <template>
  3. <view class="good-list">
  4. <view :id="'good'+good.id" class="good-li" v-for="good in list" :key="good.id">
  5. <image class="good-img" :src="good.goodImg" mode="widthFix" />
  6. <view class="flex-item">
  7. <view class="good-name">{{good.goodName}}</view>
  8. <text class="good-price">{{good.goodPrice}} 元</text>
  9. <text class="good-sold">已售{{good.goodSold}}件</text>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. list: {
  18. type: Array,
  19. default () {
  20. return []
  21. }
  22. }
  23. }
  24. }
  25. </script>
  26. <style lang="scss">
  27. .good-list {
  28. background-color: #fff;
  29. .good-li {
  30. display: flex;
  31. align-items: center;
  32. padding: 20upx;
  33. border-bottom: 1upx solid #eee;
  34. .good-img {
  35. width: 160upx;
  36. height: 160upx;
  37. margin-right: 20rpx;
  38. }
  39. .flex-item {
  40. flex: 1;
  41. .good-name {
  42. font-size: 26upx;
  43. line-height: 40upx;
  44. height: 80upx;
  45. margin-bottom: 20upx;
  46. overflow: hidden;
  47. }
  48. .good-price {
  49. font-size: 26upx;
  50. color: red;
  51. }
  52. .good-sold {
  53. font-size: 24upx;
  54. margin-left: 16upx;
  55. color: gray;
  56. }
  57. }
  58. }
  59. }
  60. </style>