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