0.2.0 • Published 6 years ago
lm-signature v0.2.0
signature
- 作者:fengdewang
- 邮箱:fengdewang@58ganji.com
- 版本:
0.2.0
介绍
canvas签名
安装
lm-*
组件使用 npm
进行管理,命名空间统一为 lm-
,请使用以下命令进行组件安装。
npm i lm-signature --save
- 如果你还没有安装
npm
,可通过以下方式进行 安装。 - 安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
使用
样例文档
- 待开发
使用
最少配置参数为:
this.refs['signature'].clear(); //清空画布
this.refs['signature'].isEmpty(); //判断画布是否为空
this.refs['signature'].toDataURL('image/jpeg'); //把画布图像转成base64码
<Signature ref="signature" />
配置参数
Prop | Type | Default | Description |
---|---|---|---|
backgroundColor | string | rgba(0,0,0,0) | 画布背景色值 |
penColor | string | black | 笔触色值 |
minWidth | number | 0.5 | 笔触的最小值 |
maxWidth | number | 2.5 | 笔触的最大值 |
maxWidth | number | 2.5 | 笔触的最大值 |
onBegin | func | NOOP | 笔画开始的钩子函数 |
onEnd | func | NOOP | 笔画结束的钩子函数 |
velocityFilterWeight | number | 0.7 | 贝塞尔曲线 毛笔字 笔触粗细 |
注意事项
- 画布大小为 父级元素内容的大小
开发调试
进入项目目录后,使用 node
命令启动服务
npm run start
打包发布可通过 node
命令执行
npm run build
npm publish
相关资料
Changelog
0.1.0
- init
0.2.0
- update react to version 16