This commit is contained in:
qsh
2024-07-03 15:11:43 +08:00
parent a4c5143ee5
commit 87a2fe09de
2 changed files with 13 additions and 2 deletions

View File

@@ -65,7 +65,7 @@
</el-table-column>
<el-table-column prop="files" label="附件">
<template #default="{ row }">
<el-link type="primary" underline :href="row.fileUrl" target="_blank">
<el-link type="primary" underline target="_blank" @click="handleDownload(row.files)">
{{ row.files }}
</el-link>
</template>
@@ -195,6 +195,16 @@ function handleClickLib(index) {
getResourceList()
}
function handleDownload(href) {
if (href) {
let a = document.createElement('a')
a.download = href //指定下载的文件名
a.href = href // URL对象
a.click() // 模拟点击
URL.revokeObjectURL(a.href) // 释放URL 对象
}
}
function openResource(type, id) {
resourceDialog.value.open(type, libraryList.value[libraryIndex.value], id)
}