getBase64Image(img) {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, img.width, img.height);
var ext = img.src.substring(img.src.lastIndexOf(".")+1).toLowerCase();
var dataURL = canvas.toDataURL("image/"+ext);
return dataURL;
} ,
// 图片下载
downloadFild(fild) {
let _this=this
var image = new Image();
image.src = fild.images;
image.setAttribute("crossOrigin", "anonymous");
image.onload = function(){
var base64 =_this.getBase64Image(image);
console.log(base64)
var a = document.createElement('a')
a.download = fild.certName || 'pic'
// 设置图片地址
a.href =base64
a.click();
}
},