你猜猜我是谁
你猜猜我是谁
  • 发布:2019-11-14 16:30
  • 更新:2019-11-14 16:51
  • 阅读:924

【报Bug】HBuilderX版本2.4.1js执行canvas.toDataURL报错

分类:HBuilderX

HBuilderX版本2.4.1js执行canvas.toDataURL("image/jpeg", 0.8)报错:SecurityError (DOM Exception 18): The operation is insecure.

[mac版本号]10.14.6

var c = document.createElement('canvas');  
                var scale = 1920;//缩放  
                if (img.width > img.height) {  
                    if (img.width > scale) {  
                        img.height = scale*img.height/img.width;  
                        img.width = scale;  
                    }  
                } else {  
                    if (img.height > scale) {  
                        img.width = scale*img.width/img.height;  
                        img.height = scale;  
                    }  
                }  
                c.width = img.width;  
                c.height = img.height;  
                var ctx = c.getContext("2d");  
                ctx.drawImage(img,0,0,img.width,img.height);  
                var data = c.toDataURL("image/jpeg", 0.8);

联系方式

QQ30282629

2019-11-14 16:30 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

H5端吗?

该问题目前已经被锁定, 无法添加新回复