详细使用看这篇 https://blog.csdn.net/qq_29594393/article/details/76913495
npm地址: https://www.npmjs.com/package/signature_pad
遇到的问题
在网页测试大小尺寸完好,移动端初始化的图片很小
解决方案
let canvas = document.querySelector("canvas");
let ratio = Math.max(window.devicePixelRatio || 1, 1);
let signaWidth = this.platform.width()*0.92; //用的ionic里获取设备宽度
canvas.width = signaWidth;
canvas.height = signaWidth;
canvas.getContext("2d").scale(ratio, ratio); //这步最关键调整比列
this.signaturePad.clear(); // otherwise isEmpty() might return incorrect value
this.signaturePad.fromDataURL(this.vehicleDamageImage) //初始化的base64的图片值