<template>
  <a-carousel autoplay arrows :style="{ '--banner-height': height }">
    <!-- 左右且切换指示器 -->
    <template #prevArrow>
      <div class="custom-slick-arrow" style="left: 10px; z-index: 1">
        <left-circle-outlined />
      </div>
    </template>
    <template #nextArrow>
      <div class="custom-slick-arrow" style="right: 10px">
        <right-circle-outlined />
      </div>
    </template>
    <!-- 循环渲染 轮播图部分 -->
    <img v-for="(v, i) in bannerList" :key="i" :src="v.imgUrl" width="100" height="100" alt=""
      @click="jumpPage(v.linkUrl)">
  </a-carousel>
</template>

<script lang="ts" setup>
import { defineProps } from 'vue'
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue'

const props: any = defineProps({
  height: { type: String, default: '35vh' },
  bannerList: { type: Array, default: [] } as any
})
const jumpPage = (link: String) => {
  if (!link) return
  const a: any = document.createElement('a')
  a.href = link
  a.target = '_blank'
  a.click()
}
</script>

<style lang="less" scoped>
/* For demo */
.ant-carousel :deep(.slick-slide) {
  text-align: center;
  height: var(--banner-height);
  line-height: 160px;
  // background: #364d79;
  overflow: hidden;
  div{
    height: 500px;
  }
}



.ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
  width: 30px;
  height: 30px;
  font-size: 30px;
  color: #111111;
  // background-color: rgba(31, 45, 61, 0.11);
  opacity: 0.3;
  z-index: 1;
}

.ant-carousel :deep(.custom-slick-arrow:before) {
  display: none;
}

.ant-carousel :deep(.custom-slick-arrow:hover) {
  opacity: 0.5;
}



img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
</style>
