Skip to content

基本使用

vue

<template>
  <zeroSwiper :count="imgList.length" autoPlay :delay="2000">
    <zeroSwiperItem v-for="(src,index) in imgList" :key="index">
      <img :src="src" alt="">
    </zeroSwiperItem>
  </zeroSwiper>
</template>
<script setup>
  import {reactive} from 'vue';
  import imgpath1 from '@img/1.webp';
  import imgpath2 from '@img/2.webp';
  import imgpath3 from '@img/3.webp';
  import imgpath4 from '@img/4.webp';

  const imgList = reactive([
    imgpath1, imgpath2, imgpath3, imgpath4
  ])
</script>

属性

属性名说明可选值默认值类型
count指示点个数--Number
delay轮播间隔-2000Number
autoPlay是否自动轮播-falseBoolean
currentIndex当前显示到第几张-0Number
showButton是否显示按钮-trueBoolean