下载文件改名
不同源的话需要后台跨域,否则无法下载
downUpdateFileName(url, fileName) {
const x = new XMLHttpRequest()
x.open("GET", url, true)
x.responseType = 'blob'
x.onload=function(e) {
const url = window.URL.createObjectURL(x.response)
const a = document.createElement('a')
a.href = url
a.target = '_blank'
a.download = fileName
a.click()
a.remove()
}
x.send()
}