<template>
  <view class="container">
    <swiper
      class="swiper"
      circular
      :indicator-dots="activityList.length > 1"
      indicator-color="#FFFFFF"
      indicator-active-color="#00A6FF"
      :autoplay="autoplay"
      :interval="interval"
      :duration="duration"
    >
      <swiper-item v-for="item in activityList" :key="item.id">
        <view class="swiper-item" @click="handleClick(item)">
          <image
            class="swiper-img"
            :src="item.activityCover"
            mode="aspectFill"
          ></image>
          <view class="corner-btn">快速预定</view>
        </view>
      </swiper-item>
    </swiper>
  </view>
</template>

<script setup>
import { ref } from "vue";
import { SEND_COMMAND_TEXT } from "@/constant/constant";

const autoplay = ref(true);
const interval = ref(3000);
const duration = ref(500);

const props = defineProps({
  activityList: {
    type: Array,
    default: [],
  },
});

const handleClick = (item) => {
  uni.$emit(SEND_COMMAND_TEXT, "快速预定");
};
</script>

<style scoped lang="scss">
@import "./styles/index.scss";
</style>
