采用拍照的照片进行canvas重绘,使用canvasToTempFilePath转成临时路径
- 同样的方式在安卓上可以在1秒内完成
- uni.chooseImage 已采用压缩图的形式
- canvasToTempFilePath 已设定部分参数,如下:
let stop = setTimeout(()=>{
this.ctx.draw(false,setTimeout(()=>{
uni.canvasToTempFilePath({
canvasId: this.canvas_id,
quality: 0.5,
fileType: 'jpg',
width: this.canvas_width,
height: this.canvas_height,
destWidth: this.canvas_width,
destHeight: this.canvas_height,
success: (res)=>{
console.log('res',res)
},
fail:(err)=>{
reject(JSON.stringify(err)|| "Failed to generate poster:101")
}
},this)
},300))
clearTimeout(stop)
},300)
3***@qq.com (作者)
抱歉大佬了,是我草率了。我刚发现是canvas绘制过慢
2022-03-04 10:19