1.0.13 • Published 2 years ago

vue3-auto-scroll v1.0.13

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

介绍

一个基于requestAnimationFramevue3自动滚动组件,支持typescript

使用

局部导入

import { Vue3AutoScroll } from "vue3-auto-scroll";
import "vue3-auto-scroll/dist/style.css";

全局导入

import Vue3AutoScroll from "vue3-auto-scroll";
import "vue3-auto-scroll/dist/style.css";
app.use(Vue3AutoScroll);

例子

<template>
  <div class="wrapper">
    <vue3-auto-scroll>
      <ul>
        <li v-for="item in count" :key="item">这是第{{ item }}个元素</li>
      </ul>
    </vue3-auto-scroll>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

const count = ref(20);
</script>

<style scoped>
.wrapper {
  height: 300px;
  border: 1px solid #ccc;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
</style>

注意:要给组件的父元素设置高度overflow: hidden,原因是组件高度是设置成height:100%

props

属性类型默认值描述
hideScrollBarBooleantrue是否隐藏滚动条
speedNumber1滚动速度
delayNumber1000延迟滚动时间(单位:毫秒)
controlBooleantrue鼠标移入是否暂停滚动
backSpeedBoolean10回到顶部滚动速度
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.10

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago