【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

相关推荐
Jinuss7 分钟前
源码分析之React中createFiberRoot方法创建Fiber根节点
前端·javascript·react.js
Jinuss33 分钟前
源码分析之React中ReactDOMRoot实现
前端·javascript·react.js
摘星编程38 分钟前
React Native鸿蒙版:React Query无限滚动
javascript·react native·react.js
web守墓人42 分钟前
【前端】vue3的指令
前端
想起你的日子1 小时前
EFCore之Code First
前端·.netcore
框架图2 小时前
Html语法
前端·html
深耕AI2 小时前
【wordpress系列教程】07 网站迁移与备份
运维·服务器·前端·数据库
月空MoonSky2 小时前
解决使用Notepad++出现异型字或者繁体字体问题
java·javascript·notepad++
joan_852 小时前
input禁止自动填充
前端·elementui·vue