收藏
回答

pc端打开小程序,图片裁剪功能报错

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows 1.06.2404301 win32-x64
                      let context = canvas.getContext("2d");
  			let image = canvas.createImage();
  			await new Promise((resolve, reject) => {
  				image.onload = resolve;
  				image.onerror = reject;
  				image.src = this.url;
  			});
//canvas  小程序端用电脑从微信打开小程序(电脑系统为Lwin11,MacOS )image  监听不到load事件,context.drawImage(image, mx.sx, mx.sy, mx.sw, mx.sh, mx.dx, mx.dy, mx.dw, mx.dh);
会报错
错误提示
[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)
回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    05-16

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    05-16
    有用
    回复
登录 后发表内容