安装
shell
npm install swipe
使用
ts
import 'swiper/css';
import 'swiper/css/mousewheel';
import { Swiper, SwiperSlide } from 'swiper/vue';
import { Mousewheel } from 'swiper/modules';
containerHeight
是容器的高度,一定要设置竖直方向上滚动高度,不然会非常高!!
html
<swiper
direction="vertical"
:modules="[Mousewheel]"
:mousewheel="{
enabled: true,
}"
:speed="1500"
:slides-per-view="1"
:style="{ height: containerHeight + 'px' }"
>
文档
https://swiperjs.com/vue
https://swiperjs.com/swiper-api#mousewheel-control