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

react-dczs-image-preview

v1.0.29

Published

- 基于 react17.x 开发的预览图片组件 - 支持 放大、缩小、复原、下载、打印、旋转、拖拽等功能 - 支持 png、jpg、jpge、bmp、gif 等常见图片格式 - 支持查看多个图片 - 开箱即用 只需传图片数据 轻便简单

Readme

react-image-preview

  • 基于 react17.x 开发的预览图片组件
  • 支持 放大、缩小、复原、下载、打印、旋转、拖拽等功能
  • 支持 png、jpg、jpge、bmp、gif 等常见图片格式
  • 支持查看多个图片
  • 开箱即用 只需传图片数据 轻便简单

安装使用说明

npm i react-dczs-image-preview

// 引入组件和样式
import { reactImagePreview } from 'react-dczs-image-preview'
import 'react-dczs-image-preview/lib/style.css'

例1:
var imgData = 'xxx'
export default class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      showBox: true
    }
  }
  close = () => {
    this.setState({
      showBox: false
    })
  }
  open = () => {
    this.setState({
      showBox: true
    })
  }
  render() {
    return (
      <div>
        <button onClick={this.open}>open</button>
        <reactImagePreview
          showBox={this.state.showBox}
          imgData={imgData}
          close={this.close}
        />
      </div>
    )
  }
}

api

属性

| 属性值 | 类型 | 描述 | 默认值 | | ------------ | ------- | ------------------------------ | ------ | | imgData | string | 图片地址(url) | - | | imgArr | Array | 图片地址(数组) | - | | showBox | Boolean | 控制图片预览器显隐 | false | | customAction | Object | 自定义操作栏 | null | | isHint | Boolean | 是否展示提示(第一张或最后一张) | true | | ifWave | Boolean | 是否点击波纹特效 | false | | isAnimation | Boolean | 是否动画特效 | false |

customAction

| 属性值 | 类型 | 描述 | 默认值 | | ------------ | ------- | ------------------ | ------ | | lastCard | Boolean | 是否需要上一张 | true | | narrow | Boolean | 是否需要缩小 | true | | reduction | Boolean | 是否需要复原 | true | | enlarge | Boolean | 是否需要放大 | true | | leftRotate | Boolean | 是否需要逆时针旋转 | true | | rightRotate | Boolean | 是否需要顺时针旋转 | true | | downloadFile | Boolean | 是否需要下载 | true | | publish | Boolean | 是否需要打印 | true | | nextCard | Boolean | 是否需要下一张 | true | | mouseWheel | Boolean | 是否需要滚轮缩放 | true | | mouseDown | Boolean | 是否需要拖拽功能 | true |

事件

| 事件名 | 说明 | 回调参数 | | ------ | -------- | -------- | | close | 关闭回调 | - |

注意

  • 若引用图片地址,相对地址使用 require()包裹或使用绝对地址
  • 若 imgData 和 imgArr 同时传了 则只有 imgData 生效
  • 不支持 base64