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

crs-test-swiper

v0.0.2

Published

基于小程序 swiper 开发的 lazy swiper

Readme

taro-lazy-swiper

使用taro, 基于微信小程序 swiper 开发的 lazy swiper

应用场景

  • 大量图片的swiper 滑动预览
  • 短视频的无限/有限滑动
  • 等等

效果

https://user-images.githubusercontent.com/22277972/185527883-754dc748-b64a-4717-9f01-0fe5eaca1637.mp4

使用

测试用例

loop 模式

该模式下, 测试用例增加到了200条, 具体看 Scheduler.test.ts

loop 模式

该模式下, 测试用例还没来得及新增

安装

npm i taro-lazy-swiper

引入

import LazySwiper, {useLazySwiper} from 'taro-lazy-swiper'
import {View} from "@tarojs/components";

const dataSource = Array(10).fill(0).map((_, i) => {
  return {data: i + 1}
})

const App = () => {

  const [lazySwiper] = useLazySwiper()

  return (
    <View>
      <LazySwiper
        lazySwiper={lazySwiper}
        dataSource={dataSource}
        keyExtractor={(data) => data.toString()}
        renderContent={(data, { isActive }) => {
          return `current: ${data}`
        }}
      />
      <View className='fixed-bar'>
        <Button onClick={() => lazySwiper.prevSection()}>上一个</Button>
        <Button onClick={() => lazySwiper.nextSection()}>下一个</Button>
        <Button onClick={() => lazySwiper.toSection(0)}>回到头</Button>
      </View>
    </View>
  )
}

API

| 属性 | 类型 | 描述 | |-------------------|---------------------------------------------------------------------------|-----------------------| | dataSource | T[] | 数据源 | | keyExtractor | (data: T, index: number) => string | key 计算 | | renderContent | (data: T, info: { isActive: boolean, key: string } ) => React.ReactNode | 每个swiper item 的计算 | | maxCount | number | 同时渲染的swiper item最大数量 | | loop | boolean | 是否循环 | | duration | number | 切换动画时长 | | lazySwiper | LazySwiperExtra | 对外暴露的连接属性 | | onBeforeChange | (detail: BeforeChangeEventDetail & { playload: any }) => boolean | 变更前,可以进行拦截(手势滑动的无法拦截) | | onChange | (detail: ChangeEventDetail) => void | 当 index 变更后 | | onAnimationFinish | (detail: ChangeEventDetail) => void | index 变更之后的动画结束后 | | swiperItemExtractor | (data: T, index: number) => SwiperItemProps | swiper props 计算

共建

fork

拉取自己 fork 的项目

# ssh 方式
git clone [email protected]:[your github user name]/taro-lazy-swiper.git

启动

cd taro-lazy-swiper

npm i 

npm run dev:rollup

业务项目关联组件库

# taro-lazy-swiper
npm link


# 自己项目
npm link taro-lazy-swiper

鸣谢

NervJS/taro

NervJS/taro-uilib-react

kentcdodds/use-deep-compare-effect

epoberezkin/fast-deep-equal

等等...