vue-awesome-swiper 参数设置无效

<template>
    <swiper ref="mySwiper" :options="swiperOptions">
        <swiper-slide>Slide 1</swiper-slide>
        <swiper-slide>Slide 2</swiper-slide>
        <swiper-slide>Slide 3</swiper-slide>
        <swiper-slide>Slide 4</swiper-slide>
        <swiper-slide>Slide 5</swiper-slide>
        <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
</template>

<script>
    export default {
        name: 'carrousel',

        data() {
            return {
                swiperOptions: {
                    pagination: {
                        el: '.swiper-pagination',
                    },
                    // 以下设置都无效
                    speed:6000
                    autoplay:true

                    // Some Swiper option/callback...
                }
            }
        },
        computed: {
            swiper() {
                return this.$refs.mySwiper.$swiper
            }
        },
        mounted() {
            console.log('Current Swiper instance object', this.swiper)
            this.swiper.slideTo(2, 1000, false)
        }
    }
</script> 

官网的例子,版本最新的,自己加的speed autoplay 还有其他一些属性设置什么都没效果 怎么回事

阅读 8.4k
7 个回答

单看这个是没啥问题,检查下是否正确引入?

新手上路,请多包涵

遇到同样的问题,请问解决了么

新手上路,请多包涵

问题解决了吗??

这样试试,speed是滚动时长,不是切换时长吧,delay才是


swiperOption: {
  autoplay: {
            delay: 6000,
            disableOnInteraction: false,
            stopOnLastSlide: false,
          },//自动切换
  ...
  }
新手上路,请多包涵

还需要引入组件模块
import { Swiper, Pagination, Autoplay } from 'swiper'
Swiper.use([Pagination, Autoplay])

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题