<template>
	<view class="container">
		<!-- 轮播图 -->
		<view class="diy-banner" :style="{ height: `${imgHeights[imgCurrent]}px` }">
		  <!-- 图片轮播 -->
		  <swiper class="swiper-box" :autoplay="autoplay" :duration="duration" :circular="true" :interval="itemStyle.interval * 1000" @change="_bindChange">
		    <swiper-item v-for="(dataItem, index) in dataList" :key="index">
		      <image mode="widthFix" class="slide-image" :src="dataItem.imgUrl" @click="onLink(dataItem.link)" @load="_imagesHeight" />
		    </swiper-item>
		  </swiper>
		  <!-- 指示点 -->
		  <view class="indicator-dots" :class="itemStyle.btnShape">
		    <view class="dots-item" :class="{ active: imgCurrent == index }" :style="{ backgroundColor: itemStyle.btnColor }"
		      v-for="(dataItem, index) in dataList" :key="index"></view>
		  </view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			
		}
	}
</script>

<style lang="scss" scoped>
  .diy-banner {
    position: relative;

    // swiper组件
    .swiper-box {
      height: 100%;

      .slide-image {
        width: 100%;
        height: 100%;
        margin: 0 auto;
        display: block;
      }
    }

    /* 指示点 */
    .indicator-dots {
      width: 100%;
      height: 28rpx;
      padding: 0 20rpx;
      position: absolute;
      left: 0;
      right: 0;
      bottom: 20rpx;
      opacity: 0.8;
      display: flex;
      justify-content: center;

      .dots-item {
        width: 16rpx;
        height: 16rpx;
        margin-right: 8rpx;
        background-color: #fff;

        &:last-child {
          margin-right: 0;
        }

        &.active {
          background-color: #313131 !important;
        }
      }

      // 圆形
      &.round .dots-item {
        width: 16rpx;
        height: 16rpx;
        border-radius: 20rpx;
      }

      // 正方形
      &.square .dots-item {
        width: 16rpx;
        height: 16rpx;
      }

      // 长方形
      &.rectangle .dots-item {
        width: 22rpx;
        height: 14rpx;
      }
    }
  }
</style>
