gui-product-list.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <view class="gui-flex gui-rows gui-wrap gui-space-between">
  3. <view class="gui-product" hover-class="gui-tap"
  4. v-for="(item, index) in products" :key="index"
  5. @tap="gotoInfo(index, item)"
  6. :style="{
  7. width : (375 - margin*2)+'rpx',
  8. marginLeft : margin+'rpx',
  9. marginRight : margin+'rpx'}">
  10. <view>
  11. <gui-image :src="item.img" :width="(375 - margin*2)" :height="imgHeight"></gui-image>
  12. </view>
  13. <view class="gui-product-lines">
  14. <text class="gui-product-name">{{item.name}}</text>
  15. </view>
  16. <view class="gui-product-lines gui-flex gui-rows gui-nowrap gui-align-items-center">
  17. <text class="gui-color-red gui-text-small">¥</text>
  18. <text class="gui-h5 gui-color-red">{{item.price}}</text>
  19. <text class="gui-text-small gui-color-gray gui-line-through gui-price-margin">{{item.priceMarket}}</text>
  20. <text class="gui-text-small gui-color-gray gui-price-margin">{{item.selledNum}}人购买</text>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default{
  27. name : "gui-product-list",
  28. props : {
  29. products : {type : Array, default : function(){return [];}},
  30. margin : {type : Number, default : 15},
  31. imgHeight : {type : Number, default : 345},
  32. },
  33. methods:{
  34. gotoInfo : function (idx, item) {
  35. this.$emit('gotoInfo', idx, item);
  36. }
  37. }
  38. }
  39. </script>
  40. <style>
  41. .gui-product{margin-bottom:38rpx;}
  42. .gui-product-lines{margin-top:10rpx;}
  43. .gui-product-name{font-size:26rpx; line-height:32rpx;}
  44. .gui-price-margin{margin:0 10rpx;}
  45. </style>