<template>
  <!-- <swiper
    indicator-dots
    autoplay
    :interval="5000"
    :style="swHeight"
  >
    <block v-for="(item, index) in banners" :key="index">
      <swiper-item>
        <van-image
            width="100%"
            :data-url="item.page_url"
            :data-openSource="swiper"
            height="100%"
            :fit="swipers.fill==1?'fill':'contain'"
            :src="item.pic_url"
        />
      </swiper-item>
    </block>
  </swiper> -->
  <view :style="{background:swipers.background}">
    <view :style="{marginTop:swipers.topAndBottom+'px',marginBottom:(swipers.topAndBottom<0?0:swipers.topAndBottom)+'px',marginLeft:swipers.leftAndRight+'px',marginRight:swipers.leftAndRight+'px'}">
      <u-swiper
      :list="banners"
      :effect3d="swipers.style == 2"
      :height="swipers.height"
      :interval="5000"
      name="picUrl"
      :border-radius="swipers.radius"
      @click="clickHandler"
      ></u-swiper>
    </view>
  </view>
</template>

<script>
export default {
  props: ["swipers"],
  data() {
    return {
      banners: []
    };
  },
  created() {
	  if(this.swipers.banners.length>0){
		 this.swipers.banners.forEach(x=>{
			 x.picUrl=this.getIconLink(x.picUrl)
		 })
	  }
    this.banners = this.swipers.banners;
  },
  methods: {
    clickHandler(i) {
      if (this.banners[i].url && this.banners[i].url.length > 0) {
        uni.navigateTo({
          url: this.banners[i].url,
        });
      }
    },
  },
};
</script>

<style></style>
