安卓canvas没有响应?
发布于 5 年前 作者 futao 15268 次浏览 来自 官方Issues

代码和机器型号如下,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 >>>>>>>>');
1 回复

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

回到顶部