记swiper使用问题

<Swiper
	:space-between="50"
	:modules="[Autoplay]"
	:autoplay="{ delay: 2000, disableOnInteraction: true }"
	:loop="true"
	>
		<SwiperSlide style="display: flex; height: 80vh; align-items: center; justify-content: center" v-for="index in 11" :key="index">
			<el-image style="width: 100%; height: 100%" fit="scale-down" :src="getImgUrl(index)" alt=""/>
		</SwiperSlide>
	</Swiper>
<script lang="ts" setup>
import { Swiper, SwiperSlide } from 'swiper/vue';
import { Autoplay, Navigation } from 'swiper';
import 'swiper/css';
import 'swiper/css/effect-cube';
import 'swiper/css/pagination';
import 'swiper/css/navigation';
import 'swiper/css/autoplay';
import 'swiper/css/effect-fade';

问题:没有自动播放效果。
但是在下面这种写法的时候可以,刚开始以为是循环问题,写成固定的后还是不对,尝试修改了下用img替换了el-image解决了问题。
不知道是不是这个原因,暂且记录一下。

<Swiper
	:space-between="50"
	:modules="[Autoplay]"
	:autoplay="{ delay: 2000, disableOnInteraction: true }"
	:loop="true"
	>
		<SwiperSlide style="display: flex; height: 80vh; align-items: center; justify-content: center"> <img src="xxx1.png" alt="" /></SwiperSlide>
		<SwiperSlide style="display: flex; height: 80vh; align-items: center; justify-content: center"> <img src="xxx2.png" alt="" /></SwiperSlide> 
	</Swiper>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值