Image Editor
npm install image-editor-little !npm !npm bundle size !NPM
这是一个React截图工具的组件, 基本功能和微信截图相似, 因为使用了React Hooks, 所以对React的版本有一定要求,支持的功能:
1. 截取图片,下载处理好的图片
2. 矩形和圆形标注功能
3. 手写功能
4. 马赛克功能
5. 撤销操作
后续看情况拓展功能和优化
``shell`
yarn add image-editor-little
or
`shell`
npm install -S image-editor-little
`js
import ImageEditor from 'image-editor-little';
height={500}
src="https://miro.medium.com/max/3200/1*hLM2qGfy0VOTiyuyE3pOBA.png"
/>
`

给网页添加截图功能, 目前不会加这个功能, 不想依赖 html2canvas

| 参数 | 说明 | 类型 | 默认值 | 是否必填 |
| --- | --- | --- | --- | --- |
| src | 图片的 src | string | - | 是 |number
| width| 宽度 | | - | 否 |number
| height| 高度 | | - | 否 |string
| className| 自定义类名 | | - | 否 |string
| imageType | 下载图片格式类型 | | png | 否 |number
| locSize| 放大镜大小(x 10) | | 10 | 否 |object
| holdSize| 图片加载时, 占位 svg 宽高 | | { w: '100vw', h: '100vh' } | 否 |(close: () => void) => void
| onClose | 点击 X 触发 | | - | 否 |(close: () => void) => void
| onDownload | 点击下载触发 | | - | 否 |(url?: string, close?: () => void) => void` | - | 否 |
| onConfirm| 点击确认触发 |