- 使用一下方法,也不用去阿里云后台设置允许跨域了
downloadIamge(imgsrc, name) {
const src = `${imgsrc}?t=${new Date().getTime()}`
fetch(src).then(res => {
res.blob().then(myBlob => {
const href = URL.createObjectURL(myBlob)
const a = document.createElement('a')
a.href = href
a.download = name
a.click()
a.remove()
})
})
}