1 axios({
 2                 method: 'get',
 3                 url: url,
 4                 responseType: 'arraybuffer'
 5             }).then( res=>{
 6                 // console.log(res)
 7                 let blob = new Blob([res],{type: 'image/jpg'})
 8                 let objectUrl = URL.createObjectURL(blob)
 9                 let a = document.createElement('a');
10                 document.body.appendChild(a); //此处增加了将创建的添加到body当中
11                 a.href = objectUrl;
12                 a.download = this.formData.channelName;
13                 a.target = '_blank';
14                 a.click();
15                 a.remove(); //将a标签移除
16             })

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。