context.draw中的wx.canvasToTempFilePath,生成图片有时候是空的?
export: function() {
if (arrx.length == 0) {
wx.showModal({
title: '提示',
content: '签名内容不能为空!',
showCancel: false
});
return false;
};
const that = this;
this.data.context.draw(false, wx.canvasToTempFilePath({
x: 0,
y: 0,
quality:1,
fileType: 'png',
canvasId: 'firstCanvas',
success(res) {
console.log("res.tem",res)
console.log("res.tem",res.tempFilePath)
const {
tempFilePath
} = res;
console.log("takeimageUrl",""+tempFilePath)
that.setData({
'userInfo.signImgUrl': tempFilePath,
})
arrx=[] },
fail() {
wx.showToast({
title: '导出失败',
icon: 'none',
duration: 2000
})
}
})
)
},
以上是我的代码块,是一个签字版生成图片的方法,求助大佬,为什么有时候会生成空图片?