新版本设置autoplay怎么都不生效,看了官方的Demos才发现需要在SwiperCore上使用Autoplay组件,包括鼠标滚动这些都需要use对应的组件

<script>
import SwiperCore, { Autoplay, FreeMode, Scrollbar, Mousewheel } from "swiper";
SwiperCore.use([Autoplay, FreeMode, Scrollbar, Mousewheel]);
</script>

<template>
  <swiper
    :direction="'vertical'"
    :spaceBetween="50"
    :scrollbar="true"
    :mousewheel="true"
    :autoplay="{
      delay: 1500,
      disableOnInteraction: false,
    }"
    class="mySwiper"
  />
</template>

shellingfordly
87 声望14 粉丝

普通前端程序员