当前位置: 首页 > Web前端 > JavaScript

js实现电子签名功能

时间:2023-03-27 16:35:08 JavaScript

1:elesigncode扩展包下载1:github地址:https://github.com/yinhui1129...2:npm下载:npminstallelesigncode2:elesigncode常用方法方法名说明参数返回值init初始化方法无undoundo方法无Noneredoredo方法NoneNonetoJson将当前实例的签名数据转换为jsonNoneNonetoPng获取当前签名的base64数据pngTypeNoneNonetoJpeg获取当前签名jpeg的base64数据TypeNoneNonesetColor设置颜色thesignature:colorstringrgbhexcanbesetwithoutsetLineWidthlinewidthlineWidth:linewidthcanbesetwithoutsetBgColor设置背景颜色bgColor:colorstringrgbhexcanbesetwithoutsetPentypename:'default''writing'noclearclear签名none否isEmpty获取是否有签名返回true表示无签名,返回false表示有签名三:elesigncode实现示例1:html

撤销清除获取json获取透明图片获取不透明图片2:js如上,我们就可以实现电子签名功能