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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-swiper-lite

v0.1.11

Published

### [View examples](http://woleigequ.net/react-swiper/)

Readme

Swiper component for react.

View examples

安装

npm install --save react-swiper-lite

引入

react项目中引入

import Swiper from 'react-swiper-lite'

nextjs项目中引入

import dynamic from 'next/dynamic'
const Swiper = dynamic(
    import('react-swiper-lite')
)

使用

<Swiper
    wrapperClass="wrapperClass"
    itemClass="itemClass"
    itemStyle={{}}
    itemWidth="100%"
    needPadding={false}
    curIdx={1}
    dataList={dataSource}
    prevClass="normal"
    activeClass="active"
    onSlide={onSlide}
    renderItem={renderItem}
    itemClick={itemClick}
    needPagination={true}
    paginationWrapper=""
    paginationPrevClass=""
    paginationActiveClass=""
/>

参数

  • wrapperClass String swiper容器样式, 请勿设置transition,会造成卡顿。
  • itemClass String swiper元素样式
  • itemStyle Object swiper元素行内样式
  • itemWidth String 单个swiper元素宽度,范围1%-100%
  • needPadding Boolean 默认为true,是否需要容器两端留白
  • curIdx Number 索引,切换swiper元素设置索引即可
  • dataList Array 数据源,类型为数组
  • prevClass String 非当前选中swiper样式
  • activeClass String 当前选中swiper元素样式
  • onSlide Function 点击或滑动切换到指定索引回调,传入两个参数item,index
  • renderItem Function 渲染单个swiper子元素布局, 传入两个参数item,index
  • clickTrigger Boolean 默认为true,点击是否触发切换到该swiper元素(子元素宽度小于100%时可点击切换索引)
  • itemClick Function 点击swiper元素回调,传入两个参数item,index
  • needPagination Boolean 默认为false,是否需要分页指示器
  • paginationWrapper String 指示器父元素样式,可以通过text-align设置指示器位置
  • paginationPrevClass String 未选中指示器元素样式
  • paginationActiveClass String 当前选中索引指示器样式

运行示例

  • 克隆或下载代码
git clone https://github.com/Iamxiaozhu/react-swiper.git
  • 安装依赖
cd react-swiper
npm install
  • 运行npm script
npm start 

build

如果有需要对代码进行修改,可以使用项目中的webpack配置重新构建,或者提交代码,一起完善此组件。

npm run build  // dist/index.js