@meruem117/vue-seamless-scroll
vue-seamless-scroll
Install
# vue3
# yarn
yarn add @meruem117/vue-seamless-scroll@latest --dev
# npm
npm i @meruem117/vue-seamless-scroll@latest --save-dev
# vue2
# yarn
yarn add @meruem117/vue-seamless-scroll@latest-v2 --dev
# npm
npm i @meruem117/vue-seamless-scroll@latest-v2 --save-dev
Use
main.ts
import { createApp } from 'vue'
import App from './App.vue'
import { VueSeamlessScroll } from '@meruem117/vue-seamless-scroll'
const app = createApp(App)
app.use(VueSeamlessScroll)
app.mount('#app')
env.d.ts
declare module '@meruem117/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 | - |
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 |
|---|---|---|---|
| 0.1.8 | ^3.3.11 | MIT | |
| 0.1.7 | ^3.3.11 | MIT | |
| 0.1.6 | ^3.3.11 | MIT | |
| 0.1.5 | ^3.3.11 | MIT | |
| 0.1.4 | ^3.3.11 | MIT | |
| 0.1.3 | ^3.3.11 | MIT | |
| 0.1.2 | ^3.3.11 | MIT | |
| 0.1.1 | ^3.3.11 | MIT | |
| 0.1.0 | ^3.3.11 | MIT | |
| 0.0.19 | ^2.6.14 | MIT | |
| 0.0.18 | ^2.6.14 | MIT | |
| 0.0.17 | ^2.6.14 | MIT | |
| 0.0.16 | ^2.6.14 | MIT | |
| 0.0.15 | ^2.6.14 | MIT | |
| 0.0.14 | ^2.6.14 | MIT | |
| 0.0.13 | ^2.6.14 | MIT | |
| 0.0.12 | ^2.6.14 | MIT | |
| 0.0.11 | ^2.6.14 | MIT | |
| 0.0.10 | ^2.6.14 | MIT | |
| 0.0.9 | ^2.6.14 | MIT | |
| 0.0.8 | ^2.6.14 | MIT | |
| 0.0.6 | ^3.3.11 | MIT | |
| 0.0.5 | ^3.3.11 | MIT | |
| 0.0.4 | ^3.3.11 | MIT | |
| 0.0.3 | ^3.3.11 | MIT | |
| 0.0.2 | ^3.3.11 | MIT | |
| 0.0.1 | ^3.3.11 | MIT |