<template>
  <div class="main">
    <el-carousel height="1080px" :autoplay="false" @change="change">
      <!-- 智慧宿舍区域 -->
      <el-carousel-item>
        <DormView />
      </el-carousel-item>

      <!-- 智慧教室区域 -->
      <el-carousel-item>
        <ClassroomView />
      </el-carousel-item>

      <!-- 智慧书房区域 -->
      <el-carousel-item>
        <BookroomView />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script setup>
import { ref, provide } from 'vue'
import BookroomView from '@/views/BookroomView.vue'
import ClassroomView from '@/views/ClassroomView.vue'
import DormView from '@/views/DormView.vue'

// 当前激活索引
const activeIndex = ref(0)

// 切换轮播图回调
const change = (i) => {
  activeIndex.value = i
}

// 将activeIndex传递出去
provide('activeIndex', activeIndex)
</script>

<style lang="scss" scoped>
.main {
  width: 1920px;
  height: 1080px;
}
</style>
