0.1.8 • Published 1 year ago

@meruem117/vue-seamless-scroll v0.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vue-seamless-scroll

github: https://github.com/Meruem117/vue-seamless-scroll

Document for vue2

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滚动的速率number0.5
roller是否可以使用滚轮滚动booleantrue
distance滚轮滚动的速率number20
data接收异步数据,同步任务可不传array-

Tips

  • 如没有显示请为嵌入的标签设置字体大小
  • directiontopbottom 时,要为组件设置高度;当 directionleftright 时,要为组件设置宽度
  • reference: @david-j/vue-j-scroll
0.0.18

1 year ago

0.0.19

1 year ago

0.1.8

1 year ago

0.0.17

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.1.7

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.0.12

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.0.11

2 years ago

0.1.2

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago