let canvasId=`canvas-qr`
return new Promise((resolve, reject) => {
Taro.canvasToTempFilePath({
canvasId:canvasId,
success(res3) {
let tempFilePath = res3.tempFilePath;
ctx.drawImage(tempFilePath,0,0,100,100);
},
});
});
# 错误信息
VM3012 WAService.js:2 Unhandled promise rejection TypeError: Failed to execute ‘drawImage’ on ‘CanvasRenderingContext2D’: The provided value is not of type ‘(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)’
at CanvasRenderingContext2D.Nd.e.drawImage (VM3012 WAService.js:2)
at Index._callee2$ (createImg.js?t=wechat&s=1632809999604&v=5bac26123f77e3efc63b8794d8360e6c:176)
at m (vendors.js?t=wechat&s=1632809999604&v=6439fe6ae0559aecf05f9424f15122c6:1)
at Generator.t._invoke (vendors.js?t=wechat&s=1632809999604&v=6439fe6ae0559aecf05f9424f15122c6:1)
at Generator.e.<computed> [as next] (vendors.js?t=wechat&s=1632809999604&v=6439fe6ae0559aecf05f9424f15122c6:1)
at step (createImg.js?t=wechat&s=1632809999604&v=5bac26123f77e3efc63b8794d8360e6c:26)
at createImg.js?t=wechat&s=1632809999604&v=5bac26123f77e3efc63b8794d8360e6c:26
at VM3012 WAService.js:2
at n (VM3012 WAService.js:2)(env: macOS,mp,1.05.2105170; lib: 2.19.6)