downloadFile (item) {
var request = new XMLHttpRequest()
request.responseType = 'blob'
request.open('GET', item.previewUrl)
request.onload = function () {
var url = window.URL.createObjectURL(this.response)
var a = document.createElement('a')
document.body.appendChild(a)
a.href = url
a.download = item.name
a.click()
}
request.send()
}
前端下载(JS下载)
最新推荐文章于 2024-03-30 16:10:40 发布