小程序
小游戏
企业微信
微信支付
扫描小程序码分享
为什么在鸿蒙6.0手机的微信上面使用worker功能去做其他耗时操作后,canvasToTempFilePath就会报错:fail jsapi invalid request data。但是iOs和Android手机的微信都不会报错
2 个回答
本回答由AI生成,可能已过期、失效或不适用于当前情形,请谨慎参考
加粗
标红
插入代码
插入链接
插入图片
上传视频
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: that.resCanvasWidth / dpr,
height: that.resCanvasHeight / dpr,
destWidth: that.destWidth,
destHeight: that.destHeight,
canvas: exportCanvas,
success(res) {
console.log('canvasToTempFilePath success', res.tempFilePath);
resolve({
imagePath: res.tempFilePath,
width: that.destWidth,
height: that.destHeight,
dpr: dpr
});
},
fail(err) {
console.error('canvasToTempFilePath fail', err);
// 降级方案:尝试 toDataURL
console.warn('canvasToTempFilePath 失败,尝试 toDataURL 方案');
that.exportCanvasByDataURL(exportCanvas, dpr).then(resolve).catch(reject);
}
}, that);
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: that.resCanvasWidth / dpr,
height: that.resCanvasHeight / dpr,
destWidth: that.destWidth,
destHeight: that.destHeight,
canvas: exportCanvas,
success(res) {
console.log('canvasToTempFilePath success', res.tempFilePath);
resolve({
imagePath: res.tempFilePath,
width: that.destWidth,
height: that.destHeight,
dpr: dpr
});
},
fail(err) {
console.error('canvasToTempFilePath fail', err);
// 降级方案:尝试 toDataURL
console.warn('canvasToTempFilePath 失败,尝试 toDataURL 方案');
that.exportCanvasByDataURL(exportCanvas, dpr).then(resolve).catch(reject);
}
}, that);