(PS: 上面选择分类无法选择PC端)
PC端小程序的 webview 中 jssdk previewImage API无法使用 ,而且无法使用image.onload下载图片,一使用直接闪退
saveImage(){
let image = new Image();
image.setAttribute('crossOrigin','anonymous');
let _this=this;
image.onload = function(){
let canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = image.height;
let context = canvas.getContext("2d");
context.drawImage(image,0,0,image.width,image.height);
let url = canvas.toDataURL('image/png');
let a = document.createElement('a');
let event = new MouseEvent('click');
a.download = Math.random()*1000+'.jpg'||'photo';
a.href = url;
a.dispatchEvent(event);
}
image.src = _this.imgs[0] + '?timestemp=' + Math.floor(Math.random() * 1000);
}
请具体描述问题出现的流程,并提供能复现问题的简单代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html