<template>
  <div :class="[prefixCls, `${prefixCls}--white`]">
    <el-carousel indicator-position="outside">
      <el-carousel-item v-for="item in bannerList" :key="item.id">
        <a class="block w-full h-full" :target="item.link ? '_blank' : 'javascript:void(0)'" :href="item.link" >
          <el-image class="w-full h-full" fit="cover" :src="item.image" alt="" />
        </a>
      </el-carousel-item>
    </el-carousel>
    <!-- <img src="~/assets/images/commonBanner.png" alt="" /> -->
    <!-- <h2 class="title">{{ props.title }}</h2> -->
  </div>
</template>
<script lang="ts" setup>
import commonApi from "~/api/Common";

const props = defineProps(['title']);
const { prefixCls } = useDesign('banner');
const bannerList = ref([]);

(async function getData() {
  const {data} = await commonApi.getCarousel()
  bannerList.value = data;
}())
</script>
<style lang="scss" scoped>
  @import 'banner';
</style>
