支持文件列表可指定下载文件名

This commit is contained in:
aixianling
2023-06-20 10:08:41 +08:00
parent e983bd22a1
commit 16052ff00c

View File

@@ -47,13 +47,7 @@ export default {
methods: {
downFile(item) {
if (this.clickDownload) {
const link = document.createElement('a')
link.style.display = 'none'
link.href = item.url
link.setAttribute('download', item.name)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
this.$download(item.url, item.name)
} else window.open(`${item.url}`)
}
}