收藏
回答

ios的微信小程序无法使用wx.canvasToTempFilePath,在安卓就没问题,该咋办?

saveImage() {
				var that = this
				const [data, w, h] = screenshot(renderer, scene, camera, WebGLRenderTarget);
				const ctx = helperCanvas.getContext('2d')
				const imgData = helperCanvas.createImageData(data, w, h);
				helperCanvas.height = imgData.height;
				helperCanvas.width = imgData.width;
				ctx.putImageData(imgData, 0, 0);
				const imgDataFromCanvas = ctx.getImageData(0, 0, w, h)
				const hasPixel = imgDataFromCanvas.data.some(i => i !== 0)
				wx.canvasToTempFilePath({
					canvas: helperCanvas,
					success(res) {
						// 文件临时路径
						const local_path = res.tempFilePath
						const url = that.goto_uploadfile(local_path);
						that.useing_show.image_url = url;
						that.add_try_log();
						// that.change_load(false);
					},
					fail(err) {
						console.log("错误", err);
					}
				})
			},
回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    07-23

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

    07-23
    有用
    回复
登录 后发表内容