product.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="product">
  3. <image class="product-image" :src="image ? image : 'https://via.placeholder.com/150x200'"></image>
  4. <view class="product-title">{{title}}</view>
  5. <view class="product-price">
  6. <text class="product-price-favour">¥{{originalPrice}}</text>
  7. <text class="product-price-original">¥{{favourPrice}}</text>
  8. <text class="product-tip">{{tip}}</text>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'product',
  15. props: ['image', 'title', 'originalPrice', 'favourPrice', 'tip']
  16. }
  17. </script>
  18. <style>
  19. .product {
  20. padding: 10rpx 20rpx;
  21. display: flex;
  22. flex-direction: column;
  23. }
  24. .product-image {
  25. height: 330rpx;
  26. width: 330rpx;
  27. }
  28. .product-title {
  29. width: 300rpx;
  30. font-size: 32rpx;
  31. word-break: break-all;
  32. display: -webkit-box;
  33. overflow: hidden;
  34. text-overflow: ellipsis;
  35. -webkit-box-orient: vertical;
  36. -webkit-line-clamp: 2;
  37. }
  38. .product-price {
  39. font-size: 28rpx;
  40. position: relative;
  41. }
  42. .product-price-original {
  43. color: #E80080;
  44. }
  45. .product-price-favour {
  46. color: #888888;
  47. text-decoration: line-through;
  48. margin-left: 10rpx;
  49. }
  50. .product-tip {
  51. position: absolute;
  52. right: 10rpx;
  53. background-color: #FF3333;
  54. color: #FFFFFF;
  55. padding: 0 10rpx;
  56. border-radius: 5rpx;
  57. }
  58. </style>