代码和机器型号如下,ide和iOS还有小米8都正常
const ctx = (wx as any).createCanvasContext( 'canvas' ); ctx.drawImage(image.path, 0, 0, canvasWidth, canvasHeight); const comporessedResult: any = await new Promise((resolve, reject) => { ctx.draw( false , setTimeout(() => { const ret = (wx as any).canvasToTempFilePath({ canvasId: 'canvas' , destWidth: canvasWidth, destHeight: canvasHeight, quality: 0.4, fileType: 'jpg' , success: resolve, failed: reject }); }, 100) ); }); console.log( '>>>>>> compress end >>>>>>>>' ); |
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。