ProductItem.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="product-item">
  3. <div class="img-content" :style="{ backgroundImage: `url(https://images.weserv.nl/?url=${val.image})` }"></div>
  4. <div class="product-title">
  5. {{val.title}}
  6. </div>
  7. <div class="product-info">
  8. {{val.desc}}
  9. </div>
  10. <div class="product-tag">
  11. <van-tag style="margin-right:.1rem" type="danger" v-for="item in val.tags" :key="item">{{item}}</van-tag>
  12. </div>
  13. <div class="product-price">
  14. <span class="new-price">¥{{val.promote_price}}</span>
  15. <span class="old-price">¥{{val.price}}</span>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. props:["val"]
  22. }
  23. </script>
  24. <style scoped>
  25. .product-item{
  26. margin:.1rem 0;
  27. }
  28. .img-content{
  29. width: 100%;
  30. padding-top: 100%;
  31. /* background-image: url("https://img01.yzcdn.cn/vant/cat.jpeg"); */
  32. background-size: cover;
  33. margin-bottom: .1rem;
  34. }
  35. .product-title{
  36. font-size: .3rem;
  37. font-weight: 700;
  38. color: #111;
  39. width: 100%;
  40. overflow: hidden;
  41. white-space: nowrap;
  42. text-overflow: ellipsis;
  43. margin-bottom: .1rem;
  44. }
  45. .product-info{
  46. font-size: .25rem;
  47. color: #999;
  48. margin-bottom: .1rem;
  49. width: 100%;
  50. overflow: hidden;
  51. white-space: nowrap;
  52. text-overflow: ellipsis;
  53. }
  54. .product-tag{
  55. line-height: 0;
  56. margin-bottom: .1rem;
  57. }
  58. .product-price{
  59. font-size: 0;
  60. }
  61. .product-price .new-price{
  62. font-size: .3rem;
  63. color:#dd1944;
  64. font-weight: 700;
  65. }
  66. .product-price .old-price{
  67. font-size: .22rem;
  68. color: #999;
  69. text-decoration: line-through;
  70. }
  71. </style>