swiper插件,出现H5不能左右滑动切换bug的解决办法:
<template>
<div class="swiper-container" ref="swiperNode">
<div class="swiper-wrapper wrapper_node">
<div class="swiper-slide" v-for="carousel in list" :key="carousel.id">
<img :src="carousel.imgUrl">
</div>
</div>
<!-- 如果需要分页器 -->
<div class="swiper-pagination"></div>
<!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
</template>
在上面代码中,如果我们在swiper-wrapper后面还新增了一个自定义的class类名:wrapper_node的话,就会导致H5不能进行左右滑动切换。
解决方案:
把自定义的class类名wrapper_node删除就可以了。