@wanjunshijie/vue-seamless-scroll
A simple vue seamless scroll component.
637
| Install | |
|---|---|
npm install @wanjunshijie/vue-seamless-scroll |
|
| Latest Version: | 3.0.0 |
| Vue: | 3 |
| Older releases: | 2 |
| License: | MIT |
| Last Updated: | Sep 21, 2026 |
| Links: | GitHub · npm |
Maintainer: wanjunshijie
vue-seamless-scroll
Install
# vue3
# yarn
yarn add @wanjunshijie/vue-seamless-scroll@latest --dev
# npm
npm i @wanjunshijie/vue-seamless-scroll@latest --save-dev
# vue2
# yarn
yarn add @wanjunshijie/vue-seamless-scroll@latest-v2 --dev
# npm
npm i @wanjunshijie/vue-seamless-scroll@latest-v2 --save-dev
Use
main.ts
import { createApp } from 'vue'
import App from './App.vue'
import { VueSeamlessScroll } from '@wanjunshijie/vue-seamless-scroll'
const app = createApp(App)
app.use(VueSeamlessScroll)
app.mount('#app')
env.d.ts
declare module '@wanjunshijie/vue-seamless-scroll'
App.vue
<template>
<div class="box">
<vue-seamless-scroll class="list" :data="data" direction="top" :steep="0.5" roller :distance="20">
<div class="list-item" v-for="item, index in data" :key="index">{{ item.text }}</div>
</vue-seamless-scroll>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
let data = ref([
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
{ text: 'test' },
])
</script>
<style scoped>
.box {
width: 100%;
padding-top: 50px;
display: flex;
justify-content: center;
}
.list {
height: 300px;
overflow: hidden;
}
.list-item {
width: 500px;
height: 100px;
margin-bottom: 20px;
color: #000;
font-size: 14px;
background-color: aliceblue;
}
</style>
Api
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| direction | 滚动的方向 | 'top' | 'bottom' | 'left' | 'right' | 'top' |
| steep | 滚动的速率 | number | 0.5 |
| roller | 是否可以使用滚轮滚动 | boolean | true |
| distance | 滚轮滚动的速率 | number | 20 |
| data | 接收异步数据,同步任务可不传 | array | - |
Changelog
2026-09-20
- 新增移动端 / 平板手指拖动滚动支持(触屏拖拽)
- 修复在移动端、平板等触屏设备上手指拖动列表无法滚动的问题
- 在原有滚轮滚动基础上,补充
touchstart/touchmove/touchend触摸事件:手指按下时暂停自动滚动,拖动时列表实时跟随手指移动,松手后恢复自动滚动 - 拖动过程中对滚动范围做了边界限制,避免把列表拖出空白区域
- 通过
touch-action: none防止浏览器手势(页面滚动/缩放)劫持触摸事件
Tips
- 如没有显示请为嵌入的标签设置字体大小
- 当
direction为top或bottom时,要为组件设置高度;当direction为left或right时,要为组件设置宽度 - reference: @david-j/vue-j-scroll
Related Packages
vite-plugin-git-revision
Vite plugin that generates VERSION and COMMITHASH files during build based on a...
21,961
11
vite-plugin-resolve-extension-vue
A temporary workaround for issue No loader is configured for ".vue"
6,993
5
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 3.0.0 | ^3.3.11 | MIT | |
| 2.0.0 | ^2.6.14 | MIT | |
| 0.1.9 | ^2.6.14 | MIT | |
| 0.1.8 | ^3.3.11 | MIT |