Lan
2026-01-07 18:58:05 +08:00
parent 394437294e
commit f5e385316f
+12 -20
View File
@@ -26,10 +26,7 @@
<!-- 上传状态图标 -->
<component
:is="statusIcon"
:class="[
'w-16 h-16 transition-colors duration-300',
statusIconClass
]"
:class="['w-16 h-16 transition-colors duration-300', statusIconClass]"
/>
<!-- 文件名或占位文本 -->
@@ -53,7 +50,10 @@
<!-- 进度详情上传中显示 -->
<div v-if="isUploading && showProgressDetails" class="mt-3 w-full">
<div class="flex justify-between text-xs mb-1" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">
<div
class="flex justify-between text-xs mb-1"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
>
<span>{{ formatBytes(uploadedBytes) }} / {{ formatBytes(totalBytes) }}</span>
<span>{{ progress }}%</span>
</div>
@@ -161,19 +161,13 @@ const statusIcon = computed(() => {
const statusIconClass = computed(() => {
if (isUploading.value) {
return isDarkMode
? 'text-indigo-400 animate-spin'
: 'text-indigo-600 animate-spin'
return isDarkMode ? 'text-indigo-400 animate-spin' : 'text-indigo-600 animate-spin'
}
if (isSuccess.value) {
return isDarkMode
? 'text-green-400'
: 'text-green-600'
return isDarkMode ? 'text-green-400' : 'text-green-600'
}
if (hasError.value) {
return isDarkMode
? 'text-red-400'
: 'text-red-600'
return isDarkMode ? 'text-red-400' : 'text-red-600'
}
return isDarkMode
? 'text-gray-400 group-hover:text-indigo-400'
@@ -182,14 +176,10 @@ const statusIconClass = computed(() => {
const statusClass = computed(() => {
if (hasError.value) {
return isDarkMode
? 'border-red-500/50'
: 'border-red-300'
return isDarkMode ? 'border-red-500/50' : 'border-red-300'
}
if (isSuccess.value) {
return isDarkMode
? 'border-green-500/50'
: 'border-green-300'
return isDarkMode ? 'border-green-500/50' : 'border-green-300'
}
return ''
})
@@ -243,6 +233,8 @@ const handleFileUpload = (event: Event) => {
if (file) {
emit('fileSelected', file)
}
// 重置 input 值,允许选择同名文件
target.value = ''
}
const handleFileDrop = (event: DragEvent) => {