feat: add zip download for folders in file manager

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-06-03 01:27:35 -07:00
parent 6c81c2a32f
commit 9a2ca526a7
8 changed files with 184 additions and 4 deletions
+8 -2
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { Folder, File, ChevronRight, ChevronDown, Trash2, Copy as CopyIcon } from 'lucide-vue-next'
import { Folder, File, ChevronRight, ChevronDown, Trash2, Copy as CopyIcon, Download } from 'lucide-vue-next'
import type { FileNode } from '@/api'
defineOptions({
@@ -21,6 +21,7 @@ const emit = defineEmits<{
move: [oldPath: string, newPath: string]
rename: [path: string]
downloadFile: [path: string]
downloadZip: [path: string]
duplicate: [path: string]
}>()
@@ -100,6 +101,10 @@ function handleDrop(e: DragEvent) {
</div>
<div v-else
class="opacity-0 group-hover:opacity-100 flex items-center gap-1 ml-auto shrink-0 pr-1 transition-opacity">
<span @click.stop="$emit('downloadZip', node.path)" class="cursor-pointer text-blue-500 hover:text-blue-500/80"
title="下载为压缩包">
<Download class="h-3 w-3" />
</span>
<span @click.stop="$emit('delete', node.path)" class="cursor-pointer text-destructive hover:text-destructive/80"
title="删除">
<Trash2 class="h-3 w-3" />
@@ -111,7 +116,8 @@ function handleDrop(e: DragEvent) {
:selected-path="selectedPath" :depth="depth + 1" @select="$emit('select', $event)"
@create="$emit('create', $event)" @move="(oldPath, newPath) => $emit('move', oldPath, newPath)"
@rename="$emit('rename', $event)" @delete="$emit('delete', $event)"
@download-file="$emit('downloadFile', $event)" @duplicate="$emit('duplicate', $event)" />
@download-file="$emit('downloadFile', $event)" @download-zip="$emit('downloadZip', $event)"
@duplicate="$emit('duplicate', $event)" />
</template>
</div>
</template>