<template>
  <swiper class="swiper simple-swiper" :options="swiperOption">
    <swiper-slide v-for="(item, index) in imageList" :key="index">
      <div class="slide-content"><img :src="item" class="slide" /></div>
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
</template>

<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'

export default {
  name: 'simple-swiper',
  components: {
    Swiper,
    SwiperSlide,
  },
  props: {
    imageList: {
      type: Array,
      default: () => [],
    },
    autoplay: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      swiperOption: {
        pagination: {
          el: '.swiper-pagination',
          clickable: true,
        },
        autoplay: this.autoplay,
        loop: true,
      },
    }
  },
}
</script>

<style scoped lang="scss">
.simple-swiper {
  height: 100%;

  ::v-deep {
    .swiper-pagination-bullet-active {
      background: #535353;
    }
  }

  .slide {
    display: block;
    width: 100%;
    object-fit: cover;
  }
}
</style>
