【Vue】vue3中使用swipe竖直方向上滚动

安装

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

相关推荐
@菜菜_达6 小时前
Vue生命周期
前端·javascript·vue.js
每天吃饭的羊6 小时前
UMD和IIfe
开发语言·前端·javascript
gCode Teacher 格码致知7 小时前
Javascript提高:自定义的占位符替换-由Deepseek产生
开发语言·javascript·ecmascript
前端那点事7 小时前
Vue线上代码调试全攻略(安全无侵入,新手也能上手)
前端·vue.js
前端那点事7 小时前
Vue批量文件上传并发踩坑指南:3步解决阻塞、限流、进度混乱
前端·面试
桔筐7 小时前
Vue3 v-model 双向绑定导致循环触发的坑
前端·javascript·vue.js
Alice-YUE7 小时前
前端图片优化完全指南:从格式到加载的全面提速方案
前端·笔记·学习
fen_fen8 小时前
下载Chrome浏览器对应的Driver
前端·chrome
路光.8 小时前
ReferenceError:Can‘t find variable:structureClone
前端·javascript·html·vue2
前端那点事8 小时前
内存泄漏排查全指南:从场景识别到工具实操,新手也能上手
前端·vue.js