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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ly-scroll

v1.0.5

Published

功能:基于 better-scroll 封装的移动端滑动组件

Readme

功能:基于 better-scroll 封装的移动端滑动组件

注意1:使用前请先安装 npm install --save-dev better-scroll

注意2:使用 ly-scroll 外部必须有一个div容器定义可滑动区域大小,内部需要一个唯一子元素存放内容

例如:

  <div style="width: 100%; height: 400px" >
    <ly-scroll>
      <div>
        // 内容 scroll需要一个唯一子元素div存放内容
      </div>
    </ly-scroll>
  </div>

注意3:元素 margin 属性会对滚动区域造成影响,使用前请先 reset 样式,如body, ul 的 默认 margin 为 0

属性1:data 监听数据更新时同步更新滚动区域 例如:

    <ly-scroll :data="list" >
      <ul>
        <li v-for="item in list" >...</li>
      </ul>
    </ly-scroll>

属性2:pullup 是否启用上拉加载 默认 false, true 时监听事件 scrollToEnd 例如:

  <ly-scroll :pullup="open" @scrollToEnd="底部上拉时你想触发的事件" >
    // 内容
  </ly-scroll>
  ...
  data () {
    return {
      open: true,
    }
  },

属性3:pulldown 是否启用下拉刷新 默认 false, true 时监听事件 scrollToStart 例如:

  <ly-scroll :pulldown="open" @scrollToStart="顶部下拉时你想触发的事件" >
    // 内容
  </ly-scroll>
  ...
  data () {
    return {
      open: true,
    }
  },

属性4:listenScroll 是否监听实时滚动事件 默认 false, true 时监听事件 scroll((x, y)) 接收参数(x, y) 为滚动的实时位置坐标 例如:

  <ly-scroll :listenScroll="open" @scroll="滚动时触发事件(x, y)" >
    // 内容
  </ly-scroll>
  ...
  data () {
    return {
      open: true,
    }
  },

属性5: direction="horizontal" 开启横向滚动 默认:vertical 为垂直滚动 例如:

  <div style="width: 100%; height: 400px" >
    <ly-scroll direction="horizontal" >
      <div>
        // 内容 scroll需要一个唯一子元素div存放内容
        // 注意水平布局 display: inline-block; white-space: nowrap;
      </div>
    </ly-scroll>
  </div>

方法1: scrollToElement(el) 滚动到指定元素 ## 此处注意该元素需在可滚动范围内 例如:

    <ly-scroll ref="scroll" >
      <ul>
        <li ref="one" >1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
      </ul>
    </ly-scroll>
    // 在需要滚动的时候调用可滚到指定元素
    // this.$refs.scroll.scrollToElement(this.$refs.one)

方法2: scrollTo(x, y) 滚动到指定坐标 ## 此处注意该坐标需在可滚动范围内 例如:

    <ly-scroll ref="scroll" >
      <ul>
        <li ref="one" >1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
      </ul>
    </ly-scroll>
    // 在需要滚动的时候调用可滚到指定坐标
    // this.$refs.scroll.scrollTo(0, 0)

其它属性与方法:待补充

联系作者:[email protected]