Gathering detailed insights and metrics for images-viewer-react
Gathering detailed insights and metrics for images-viewer-react
Gathering detailed insights and metrics for images-viewer-react
Gathering detailed insights and metrics for images-viewer-react
react-images-viewer
Create an react-images-viewer component.
react-pdf
Display PDFs in your React app as easily as if they were images.
@haz3l/react-images-viewer
Create an react-images-viewer component.
react-wx-images-viewer
Images viewer is a react component use in mobile website App, that function same as Weixin native viewer.
Multi - picture preview, support zooming, rotating, fast switching
npm install images-viewer-react
Typescript
Module System
Node Version
NPM Version
TypeScript (83.57%)
JavaScript (9.49%)
Less (6.95%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
6 Stars
121 Commits
1 Forks
1 Watchers
2 Branches
2 Contributors
Updated on Dec 26, 2023
Latest Version
1.5.2
Package Id
images-viewer-react@1.5.2
Unpacked Size
1.07 MB
Size
355.46 kB
File Count
14
NPM Version
6.14.8
Node Version
14.15.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
62
react image viewers.
因为需要支持图片和 pdf 的预览、放大、缩小、折叠、打印下载等功能,所以写了这个组件
react >= 16.8.0 | react-dom >= 16.8.0
1npm install images-viewer-react --save
1import * as React from 'react' 2import Viewer from 'images-viewer-react' 3 4function App() { 5 const [visible, setVisible] = React.useState(false) 6 7 return ( 8 <div> 9 <button 10 onClick={() => { 11 setVisible(true) 12 }} 13 > 14 show 15 </button> 16 <Viewer 17 visible={visible} 18 onClose={() => { 19 setVisible(false) 20 }} 21 images={[{ src: '', alt: '' }]} 22 /> 23 </div> 24 ) 25}
props | type | default | description | required |
---|---|---|---|---|
visible | string | false | 是否显示 | true |
onClose | function | - | 关闭预览窗口函数 | true |
images | ImageDecorator[] | [] | 预览的图片数组 | true |
activeIndex | number | 0 | 当前预览图片的 index | false |
zIndex | number | 1000 | 预览图片的时候 zIndex | false |
container | HTMLElement | null | inline 模式的容器 | false |
drag | boolean | true | 拖拽图片的回调 | false |
attribute | boolean | true | 是否显示图片属性 | false |
zoomable | boolean | true | 是否显示缩放按钮 | false |
rotatable | boolean | true | 是否显示旋转按钮 | false |
scalable | boolean | true | 是否显示缩放按钮 | false |
onMaskClick | (e) => void | - | 当蒙版被点击时的回调函数 | false |
downloadable | boolean | false | 是否显示下载按钮 | false |
noClose | boolean | false | 是否隐藏关闭按钮 | false |
noNavbar | boolean | false | 是否隐藏导航条 | false |
noToolbar | boolean | false | 是否隐藏工具栏 | false |
noImgDetails | boolean | false | 是否隐藏图片详情(width/height) | false |
noFooter | boolean | false | 是否隐藏不呈现页脚 | false |
changeable | boolean | true | 是否隐藏更改按钮 | false |
customToolbar | (defaultToolbarConfigs: ToolbarConfig[]) => ToolbarConfig[] | - | 自定义工具栏 | false |
zoomSpeed | number | 0.05 | 变焦速度 | false |
defaultSize | ViewerImageSize | - | 默认图片大小 | false |
defaultImg | viewerdefaultimg | - | 如果图片加载失败显示的默认图片 | false |
disableKeyboardSupport | boolean | false | 禁用键盘支持 | false |
noResetZoomAfterChange | boolean | false | 没有复位变焦后的图像变化 | false |
noLimitInitializationSize | boolean | false | 没有限制图像初始化大小 | false |
defaultScale | number | 1 | 默认的放大缩小倍数 | false |
onChange | (activeImage: ImageDecorator, index: number) => void | - | 当图片改变时回调的回调 | false |
onPreButton | () => void | - | 点击上一张(当 activeIndex<5>) | false |
onNextButton | () => void | - | 点击下一张(当 activeIndex>images.length-5 | false |
loop | boolean | true | 导航条是否允许图片可循环 | false |
disableMouseZoom | boolean | false | 是否禁用鼠标滚动缩放图片大小 | false |
downloadInNewWindow | boolean | false | 是否在新窗口中下载 | false |
className | string | - | 自定义样式名 | false |
showTotal | boolean | true | 是否显示总数和范围 | false |
maxScale | number | - | 最大缩放 | false |
minScale | number | 0.1 | 最小缩放 | false |
props | type | default | description | required |
---|---|---|---|---|
src | string | - | 图片资源 | true |
alt | string | - | 图片描述 | false |
downloadUrl | string | - | 图片下载的地址 | false |
defaultSize | ViewerImageSize | - | 图片大小 | false |
props | type | default | description | required |
---|---|---|---|---|
width | number | - | 图片宽度 | true |
height | number | - | 图片高度 | true |
props | type | default | description | required |
---|---|---|---|---|
src | number | - | 图片资源 | true |
width | number | - | 图片宽度 | false |
height | number | - | 图片高度 | false |
props | type | default | description | required |
---|---|---|---|---|
key | string | - | 对应的 key | true |
render | React.ReactNode | - | 工具 render 的内容 | false |
onClick | function | - | 点击时候的回调 | false |
Esc
: 关闭预览的视图.←
: 查看上一张.→
: 查看下一张.↑
: 放大图片.↓
: 缩小图片.Ctrl + 1
: 重置图片或者 pdf 资源.Ctrl + ←
: 图片左旋转.Ctrl + →
: 图片又旋转.MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
112 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More