let context = canvas.getContext("2d");
let image = canvas.createImage();
await new Promise((resolve, reject) => {
image.onload = resolve;
image.onerror = reject;
image.src = this.url;
});
会报错
错误提示
[Component] <canvas>: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0. Error: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
at l.<anonymous> (9c614b8d0c61e710871cb03a5c1c016f-9115-V0FXZWJ2aWV3Lmpz.cachedata:1:1333197)
at Generator.next (<anonymous>)
at n (9c614b8d0c61e710871cb03a5c1c016f-9115-V0FXZWJ2aWV3Lmpz.cachedata:1:4032)
at s (9c614b8d0c61e710871cb03a5c1c016f-9115-V0FXZWJ2aWV3Lmpz.cachedata:1:4235)
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。