diff --git a/src/components/file/list.vue b/src/components/file/list.vue index 168fae8..3d45a91 100644 --- a/src/components/file/list.vue +++ b/src/components/file/list.vue @@ -205,18 +205,18 @@
- - - 下载文件 - - - - 打印文件 - + + + + + + + + + + + +
@@ -265,6 +265,7 @@ function filePreview(file) { translateX.value = 0; translateY.value = 0; moveFlag = false; + downloadFile(file) // if (!file?.filePath) { // ElMessage?.warning?.('文件路径不存在,无法下载') // return @@ -309,6 +310,15 @@ function filePreview(file) { // moveFlag = false; } +function downloadFile(file) { + const a = document.createElement('a') + a.href = `${BASE_PATH}/file/stream/${file.filePath}` + a.download = file.fileName || '' + a.style.display = 'none' + document.body.appendChild(a) + a.click() + document.body.removeChild(a) +} function remove(index) { const files = [...props.files];