为什么不百度
为什么不百度
  • 发布:2023-12-20 10:16
  • 更新:2023-12-20 11:04
  • 阅读:264

canvas 的 toDataURL 对应 uni.canvasToTempFilePath 方法吗

分类:uni-app

我看js 有 toDataURL 方法 但是 uniapp 通过 uni.createCanvasContext('canvas') 返回的 实例并没有这个方法 是对应 uni.canvasToTempFilePath 吗

2023-12-20 10:16 负责人:无 分享
已邀请:

最佳回复

喜欢技术的前端

喜欢技术的前端 - QQ---445849201

是的,生成图片的文件

uni.canvasToTempFilePath({  
                  x: 0,  
                  y: 0,  
                  width: 300,  
                  height: 200,  
                  destWidth: 300,  
                  destHeight: 200,  
                  canvasId: 'firstCanvas',  
                  success: function(res) {  
                    // 在H5平台下,tempFilePath 为 base64  
                    console.log(res.tempFilePath)  
                  }   
                })

要回复问题请先登录注册