<template>
  <div>
    
    <swiper id="swiperBox" :options="swiperOption" ref="mySwiper">
      <swiper-slide class="swiper-slide">
        <NavBar class="NavBar"/>
        <Boutique class="home-item" ref="Boutique" />
      </swiper-slide>
      <swiper-slide class="swiper-slide">
        <Virtural class="home-item" ref="Virtural" />
      </swiper-slide>
      <swiper-slide class="swiper-slide">
        <CulturalRelic class="home-item" ref="CulturalRelic" />
      </swiper-slide>
      <swiper-slide class="swiper-slide">
        <Display class="home-item" ref="Display" />
      </swiper-slide>
      <swiper-slide class="swiper-slide">
        <MuseumMap class="home-item" ref="MuseumMap" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
    <Footer/>
  </div>
</template>
 
<script>
import NavBar from "@/components/NavBar";
import Footer from "@/components/Footer";
import Boutique from "./components/Boutique.vue";
import MuseumMap from "./components/MuseumMap.vue";
import Virtural from "./components/Virtural.vue";
import Display from "./components/Display.vue";
import CulturalRelic from "./components/CulturalRelic.vue";
import { swiper, swiperSlide } from "vue-awesome-swiper";
export default {
  components: {
    NavBar,
    Footer,
    swiper,
    swiperSlide,
    MuseumMap,
    Boutique,
    Virtural,
    Display,
    CulturalRelic,
  },
  name: "Home",
  data() {
    return {
      list: [1, 2, 3, 4],
      swiperOption: {
        notNextTick: true, //notNextTick是一个组件自有属性，如果notNextTick设置为true，组件则不会通过NextTick来实例化swiper，也就意味着你可以在第一时间获取到swiper对象，假如你需要刚加载遍使用获取swiper对象来做什么事，那么这个属性一定要是true
        direction: "vertical", //垂直方向移动
        grabCursor: true, //鼠标覆盖Swiper时指针会变成手掌形状，拖动时指针会变成抓手形状
        setWrapperSize: true, //Swiper使用flexbox布局(display: flex)，开启这个设定会在Wrapper上添加等于slides相加的宽或高，在对flexbox布局的支持不是很好的浏览器中可能需要用到。
        autoHeight: true, //自动高度。设置为true时，wrapper和container会随着当前slide的高度而发生变化
        slidesPerView: 1, //设置slider容器能够同时显示的slides数量(carousel模式)。可以设置为数字（可为小数，小数不可loop），或者 'auto'则自动根据slides的宽度来设定数量。loop模式下如果设置为'auto'还需要设置另外一个参数loopedSlides。
        mousewheel: true, //开启鼠标滚轮控制Swiper切换。可设置鼠标选项，默认值false
        mousewheelControl: true, //同上
        height: window.innerHeight, // 高度设置，占满设备高度
        resistanceRatio: 0, //抵抗率。边缘抵抗力的大小比例。值越小抵抗越大越难将slide拖离边缘，0时完全无法拖离。本业务需要
        observeParents: true, //将observe应用于Swiper的父元素。当Swiper的父元素变化时，例如window.resize，Swiper更新
        // 分页器
        pagination: {
          el: ".swiper-pagination",
          bulletClass: "my-bullet", //自定义分页器样式
          bulletActiveClass: "my-bullet-active", //自定义当前选中样式
          clickable: true, //点击切换轮播
        },
      },
    };
  },

  computed: {
    swiper() {
      return this.$refs.mySwiper.swiper;
    },
  },
};
</script>
<style lang="scss" scoped>
.my-bullet {
  display: block;
  width: 11px;
  height: 11px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  margin: 10px 0;
}
.my-bullet-active {
  width: 11px;
  height: 25px;
  background: #fff;
  border-radius: 20px;
  margin: 10px 0;
}

.home-item {
  height: 100vh;
  width: 100%;
}
  .navBar {
    position: absolute;
    top: 0;
    background: rgba(0, 0, 0, 0.25); // left: 0;
    transition: all 1s ease;
  }
</style>