<template>
  <view style="padding: 0 32rpx;">
    <swiper 
      class="swiper" 
      :current="current"
      :autoplay="false"
      :display-multiple-items="2.09"
      @change="onChange"
    >
      <swiper-item v-for="item in list" :key="item.id" style="display: inline-block;">
        <view class="swiper-item">
          <productCard 
            :data="item"
            cardStyle="width: 100%; height: 192px;"
            imgStyle="width: 100%; height: 110px;"
          ></productCard>
        </view>
      </swiper-item>
      <swiper-item style="display: inline-block;">
        <view class="swiper-item"></view>
      </swiper-item>
      <swiper-item style="display: inline-block;">
        <view class="swiper-item"></view>
      </swiper-item>
    </swiper>

    <indicator :current="current" :length="list.length" @click="current = $event"></indicator>
  </view>
</template>

<script>
  import productCard from '@/pages_order/product/productCard.vue'
  import indicator from '@/components/home/indicator.vue'

  export default {
		components: {
      productCard,
      indicator,
    },
		data() {
			return {
        current: 0,
        list: [],
			}
		},
		mounted() {
      this.list = [
        {
          id: '001',
					url: '', 
          name: '心电图检查',
          price: 688.00,
          originalPrice: 1664,
        },
        {
          id: '002',
					url: '', 
          name: '甲状腺功能检查',
          price: 688.00,
          originalPrice: 1664,
        },
        {
          id: '003',
					url: '', 
          name: '心电图检查',
          price: 688.00,
          originalPrice: 1664,
        },
			]
		},
		methods: {
      onChange(e) {
        this.current = e.detail.current
      }
		},
  }
</script>

<style scoped lang="scss">

.swiper {
  width: 100vw;
  height: 194px;
  margin-bottom: 24rpx;

  &-item {
    width: 100%;
    height: 460rpx;
    padding-right: 32rpx;
    box-sizing: border-box;
  }
}

</style>