vue 实现文件的下载

下载事件,创建a标签直接使用下载属性
download(row) { // window.open(process.env.VUE_APP_BASE_API + "/hospital/file/downloadFile?tPath=" + tPath) var name = row.tFileName; var url = row.tFilePath; const a = document.createElement('a') a.setAttribute('download', name) a.setAttribute('target', '_blank') a.setAttribute('href', url) a.click()
}
posted @ 2022-03-04 08:42  嗨嗨嗨包子Z  阅读(231)  评论(0)    收藏  举报