You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
1.5 KiB

1 year ago
  1. <template>
  2. <view class="produce-list">
  3. <view class="produce-item"
  4. v-for="(item,index) in list"
  5. :key="index"
  6. @click="goProduct(item)"
  7. >
  8. <view class="">
  9. <image
  10. mode="aspectFill"
  11. :src="item.image ? item.image.split(',')[0] : ''"
  12. alt="" class="img"/>
  13. </view>
  14. <view class="title">
  15. {{ item.title }}
  16. </view>
  17. <view>
  18. <text class="price">{{ item.price }}</text>
  19. <text class="oldPrice" v-if="item.oldPrice">{{ item.oldPrice }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. name:"productList",
  27. props : {
  28. list : {
  29. default : [],
  30. }
  31. },
  32. data() {
  33. return {
  34. };
  35. },
  36. methods : {
  37. goProduct(e){
  38. uni.navigateTo({
  39. url: '/pages/productDetail/productDetail?id=' + e.id
  40. });
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .produce-list{
  47. display: flex;
  48. flex-wrap: wrap;
  49. margin: 5px;
  50. .produce-item{
  51. width: calc(50% - 10px);
  52. height: calc(50% - 10px);
  53. box-shadow: 1px 1px 1px 1px #00000005;
  54. margin: 5px;
  55. box-sizing: border-box;
  56. background-color: #fff;
  57. padding: 20px;
  58. border-radius: 20rpx;
  59. .img{
  60. width: 100%;
  61. height: 360rpx;
  62. }
  63. .title{
  64. font-size: 23rpx;
  65. line-height: 2em;
  66. text-overflow: ellipsis;
  67. display: -webkit-box;
  68. -webkit-box-orient: vertical;
  69. -webkit-line-clamp: 1;
  70. overflow: hidden;
  71. }
  72. .price{
  73. font-size: 29rpx;
  74. padding-right: 8px;
  75. color: #E01717;
  76. }
  77. .oldPrice{
  78. font-size: 20rpx;
  79. text-decoration: line-through;
  80. color: #B8B8B8;
  81. }
  82. }
  83. }
  84. </style>