<template>
  <div class="swiper-container">
    <swiper class="swiper-wrapper swiper-wrapper-n" :options="swiperOption">
      <swiper-slide class="swiper-slide" v-for="(item,index) in imgs" :key="index">
          <img class="main-img" :src="item">
      </swiper-slide>
      <div class="swiper-pagination" id="pagination" slot="pagination">
        <div class="swiper-button-prev swiper-button-white"></div>
        <div class="swiper-button-next swiper-button-white"></div>
      </div>
    </swiper>
  </div>
</template>
<script>
import 'swiper/dist/css/swiper.css'
import { swiper, swiperSlide } from 'vue-awesome-swiper'

export default {
  data () {
    return {
      imgs: [
        this.$cdn + '/images/slider_img/slider_1.jpg',
        this.$cdn + '/images/slider_img/slider_2.jpg',
        this.$cdn + '/images/slider_img/slider_3.jpg',
        this.$cdn + '/images/slider_img/slider_4.jpg',
        this.$cdn + '/images/slider_img/slider_5.jpg',
        this.$cdn + '/images/slider_img/slider_6.jpg',
        this.$cdn + '/images/slider_img/slider_7.jpg',
        this.$cdn + '/images/slider_img/slider_8.jpg'
      ],

      swiperOption: {
        slidesPerView: 'auto',
        autoplay: true,
        centeredSlides: true,
        watchSlidesProgress: true,
        // pagination: {
        //   el: '.swiper-pagination'
        // },
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev'
        },
        loop: true,
        paginationClickable: true,
        on: {
          progress: function () {
            var a = this
            var b, c, d
            for (b = 0; b < a.slides.length; b++) {
              c = a.slides[b]
              d = c.progress
              var scale = 1 - Math.min(Math.abs(0.2 * d), 1)
              var es = c.style
              es.opacity = 1 - Math.min(Math.abs(d / 2), 1)
              es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform =
                'translate3d(0px,0,' +
                -Math.abs(400 * d) +
                'px) scale(' +
                scale +
                ')'
            }
          },
          setTransition: function (b) {
            var a = this
            for (var c = 0; c < a.slides.length; c++) {
              var es = a.slides[c].style
              es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration =
                b + 'ms'
            }
          }
        }
      }
    }
  },
  components: {
    swiper,
    swiperSlide
  }
}
</script>
<style type="text/css" scoped>
.swiper-container {
  width: 100%;
  -webkit-perspective: 1200px;
  -moz-perspective: 1200px;
  -ms-perspective: 1200px;
  perspective: 1200px;
}

.swiper-wrapper {
  margin-top: 10px;
}

.swiper-slide {
  width: 60%;
  transform-style: preserve-3d;
}

.swiper-slide .main-img {
  width: 100%;
  margin: 0 auto;
  display: block;
  border-radius: 10px;
}

#pagination {
  position: absolute;
  bottom: 100px;
  width: 100%;

}

.swiper-button-white{
  -webkit-tap-highlight-color:transparent;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

#pagination .swiper-pagination-bullet {
  width: 9.5%;
  float: left;
  margin: 0 0 0 6.15%;
  background: 0;
  opacity: 1;
}

.swiper-pagination-bullet i {
  background: #41203f;
  width: 24px;
  height: 24px;
  line-height: 24px;
  font-size: 12px;
  border-radius: 50px;
  display: block;
  font-style: normal;
  text-align: center;
  margin: 0 auto;
  color: #f5b55c;
}

.swiper-pagination-bullet-active i {
  transform: scale(1.5);
  background-size: auto 100%;
  color: #815d4b;
}

@media screen and (min-height: 481px) {
  .swiper-wrapper {
    margin-top: 20px;
  }
  #pagination {
    bottom: 110px;
  }
}

@media screen and (min-height: 569px) {
  .swiper-wrapper {
    margin-top: 40px;
  }
  #pagination {
    bottom: 120px;
  }
  .swiper-pagination-bullet i {
    width: 30px;
    height: 30px;
    line-height: 30px;
    font-size: 15px;
  }
}
</style>
<style type="text/css">
</style>
