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

swiper-sandglass

v1.0.0

Published

应用于大数据展示时,列表滚动类型的模块。

Downloads

1

Readme

swiper-sandglass

应用于大数据展示时,列表滚动类型的模块。

需求

列表数据不断的增加,保证元素平滑滚动,且不过多的增加dom元素数量。

使用

<SandGlassData
  ref="sandglass"
  :moreData="sandData"
  style="height: 300px;"
  >
  <template v-slot:default="{data}">
    <p>NUM {{data}}</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
  </template>
</SandGlassData>

<button @click="$refs.sandglass.play()">play</button>
<button @click="$refs.sandglass.pause()">puase</button>
<button @click="$refs.sandglass.add()">add</button>

设计

  • 处理:让dom容器作为一个漏斗,数据从天上掉入沙漏,设置沙漏有蓄沙功能,到蓄沙饱和时,排出最下面沙子,即先进先漏。如图:
  ---        ---        ---                -|
 ---        ---        ---                  |- 待显示数据
  --         --         --                 -|

\    /     \----/     \----/     \----/    -|
 \--/       \--/       \--/       \--/      |- 显示数据(dom渲染)
  \/         \/         \/         \/      -|

                        - -                 |- 益出数据(被删除)
 未满        满了        溢出      停止掉入
  • dom与数据设计
    • dom内容更新,按照展示方向,纵上,横左,是最新的数据
      • 新进元素从“上”,“左”进入
    • 数据分为:显示数据,待显示数据,益出数据
      • dom渲染“显示数据”
      • 定时程序或事件,将待显示数据依次传入显示数据容器
      • 益出数据会被删除

props

参数 | 描述 | 类型 | 默认值 | 可选值 :---|:---|:---|:---|:-- moreData | 待展示数据 | Array | [] | - direction | 横纵展示方向 | String | vertical | horizontal/vertical slidesPerView | 容器内元素显示个数 | Number | 4 | - duration | 移动停顿的时间 | Number | 3000 | - moveTime | 元素移动的时间 | Number | 1500 | - autoMove | 是否自动移动 | Boolean | true | true/false

methods

事件 | 描述 :---|:--- play|播放移动 pause|暂停移动 add|配合autoMove:false使用,显示数据中增加一条待显示数据

slot

默认插槽