普兆健康管家前端代码仓库
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.

91 lines
1.8 KiB

  1. <template>
  2. <view>
  3. <swiper
  4. class="swiper"
  5. :current="current"
  6. :autoplay="false"
  7. :display-multiple-items="1.8"
  8. @change="onChange"
  9. >
  10. <swiper-item v-for="item in list" :key="item.id" style="display: inline-block;">
  11. <view class="swiper-item">
  12. <productCard
  13. :data="item"
  14. cardStyle="width: 100%; height: 228px;"
  15. imgStyle="width: 100%; height: 130px;"
  16. ></productCard>
  17. </view>
  18. </swiper-item>
  19. <swiper-item style="display: inline-block;">
  20. <view class="swiper-item"></view>
  21. </swiper-item>
  22. </swiper>
  23. <indicator :current="current" :length="list.length" @click="current = $event"></indicator>
  24. </view>
  25. </template>
  26. <script>
  27. import productCard from '@/pages_order/product/productCard.vue'
  28. import indicator from '@/components/home/indicator.vue'
  29. export default {
  30. components: {
  31. productCard,
  32. indicator,
  33. },
  34. data() {
  35. return {
  36. current: 0,
  37. list: [],
  38. }
  39. },
  40. mounted() {
  41. this.list = [
  42. {
  43. id: '001',
  44. url: '',
  45. name: '月度装定制营养包',
  46. sales: 24770,
  47. price: 688.00,
  48. originalPrice: 1664,
  49. },
  50. {
  51. id: '002',
  52. url: '',
  53. name: '月度装定制营养包',
  54. sales: 24770,
  55. price: 688.00,
  56. originalPrice: 1664,
  57. },
  58. {
  59. id: '003',
  60. url: '',
  61. name: '月度装定制营养包',
  62. sales: 24770,
  63. price: 688.00,
  64. originalPrice: 1664,
  65. },
  66. ]
  67. },
  68. methods: {
  69. onChange(e) {
  70. this.current = e.detail.current
  71. }
  72. },
  73. }
  74. </script>
  75. <style scoped lang="scss">
  76. .swiper {
  77. width: 100vw;
  78. height: 230px;
  79. margin-bottom: 24rpx;
  80. &-item {
  81. height: 460rpx;
  82. padding-left: 32rpx;
  83. }
  84. }
  85. </style>