npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lg-vue3-seamless-scroll

v2.0.3

Published

Lg Vue3.0 无缝滚动组件

Downloads

14

Readme

vue3-seamless-scroll

Vue3.0 无缝滚动组件,支持Vite2.0,支持服务端打包

目前组件支持上下左右无缝滚动,单步滚动,并且支持复杂图标的无缝滚动,目前组件支持平台与Vue3.0支持平台一致。

效果展示

image

安装

  • npm

    npm install vue3-seamless-scroll --save
  • Yarn

    yarn add vue3-seamless-scroll
  • browser

    <script src="https://unpkg.com/browse/[email protected]/dist/vue3-seamless-scroll.min.js"></script>

组件配置

  • list

    无缝滚动列表数据,组件内部使用列表长度。

      type: Array
      required: true
  • v-model

    通过v-model控制动画滚动与停止,默认开始滚动

      type: Boolean,
      default: true,
      required: false
  • direction

    控制滚动方向,可选值updownleftright

      type: String,
      default: "up",
      required: false
  • isWatch

    开启数据更新监听

      type: Boolean,
      default: true,
      required: false
  • hover

    是否开启鼠标悬停

      type: Boolean,
      default: false,
      required: false
  • count

    动画循环次数,默认无限循环

      type: Number,
      default: "infinite",
      required: false
  • limitScrollNum

    开启滚动的数据量,只有列表长度大于等于该值才会滚动

      type: Number,
      default: 5,
      required: false
  • step

    步进速度

      type: Number,
      required: false
  • singleHeight

    单步运动停止的高度

      type: Number,
      default: 0,
      required: false
  • singleWidth

    单步运动停止的宽度

      type: Number,
      default: 0,
      required: false
  • singleWaitTime

    单步停止等待时间(默认值 1000ms)

      type: Number,
      default: 1000,
      required: false
  • isRemUnit

    singleHeight and singleWidth 是否开启 rem 度量

      type: Boolean,
      default: true,
      required: false
  • delay

    动画延时时间

      type: Number,
      default: 0,
      required: false
  • ease

    动画效果,可以传入贝塞尔曲线数值

      type: String | cubic-bezier,
      default: "ease-in",
      required: false
  • copyNum

    拷贝列表次数,默认拷贝一次,当父级高度大于列表渲染高度的两倍时可以通过该参数控制拷贝列表次数达到无缝滚动效果

      type: Number,
      default: 1,
      required: false
  • wheel

    在开启鼠标悬停的情况下是否开启滚轮滚动,默认不开启

      type: boolean,
      default: false,
      required: false
  • singleLine

    启用单行横向滚动

      type: boolean,
      default: false,
      required: false

注意项

需要滚动的列表所在容器必须设置样式 overflow: hidden;

使用

注册组件

  • 全局组件注册 install
  // **main.js**
  import { createApp } from 'vue';
  import App from './App.vue';
  import vue3SeamlessScroll from "vue3-seamless-scroll";
  const app = createApp(App);
  app.use(vue3SeamlessScroll);
  app.mount('#app');
  • 单个.vue文件局部注册
<script>
  import { defineComponent } from "vue";
  import { Vue3SeamlessScroll } from "vue3-seamless-scroll";
   export default defineComponent({
      components: {
        Vue3SeamlessScroll
      }
   })
</script>

使用组件

<template>
  <vue3-seamless-scroll :list="list" class="scroll">
    <div class="item" v-for="(item, index) in list" :key="index">
      <span>{{item.title}}</span>
      <span>{{item.date}}</span>
    </div>
  </vue3-seamless-scroll>
</template>
<script>
import { defineComponent, ref } from "vue";
import { Vue3SeamlessScroll } from "vue3-seamless-scroll";

export default defineComponent({
  name: "App",
  components: {
    Vue3SeamlessScroll
  },
  setup() {
    const list = ref([
      {
        title: "Vue3.0 无缝滚动组件展示数据第1条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第2条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第3条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第4条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第5条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第6条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第7条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第8条",
        date: Date.now(),
      },
      {
        title: "Vue3.0 无缝滚动组件展示数据第9条",
        date: Date.now(),
      },
    ]);
    return { list };
  },
});
</script>

<style>
.scroll {
  height: 270px;
  width: 500px;
  margin: 100px auto;
  overflow: hidden;
}

.scroll .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
}
</style>