Skip to content

Commit 1a7aa9c

Browse files
author
Taois
committed
feat:备份还原界面报错
1 parent e9491d8 commit 1a7aa9c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

dashboard/src/components/BackupRestoreDialog.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<div class="restore-actions">
7878
<a-upload
7979
ref="uploadRef"
80+
:key="uploadKey"
8081
:show-file-list="false"
8182
:auto-upload="false"
8283
:custom-request="() => {}"
@@ -201,6 +202,7 @@ const restoreLoading = ref(false)
201202
const selectedFile = ref(null)
202203
const fileList = ref([])
203204
const uploadRef = ref(null)
205+
const uploadKey = ref(0) // 用于强制重新渲染Upload组件
204206
205207
// 计算属性:是否可以还原
206208
const canRestore = computed(() => {
@@ -312,11 +314,8 @@ const handleFileChange = (fileListParam, file) => {
312314
const handleRemoveFile = (file) => {
313315
selectedFile.value = null
314316
fileList.value = []
315-
316-
// 清空 Upload 组件的文件列表
317-
if (uploadRef.value) {
318-
uploadRef.value.clearFiles()
319-
}
317+
// 强制重新渲染Upload组件
318+
uploadKey.value++
320319
321320
Message.info('已移除选中的备份文件')
322321
}
@@ -367,6 +366,14 @@ const handleRestore = async () => {
367366
})
368367
}
369368
369+
// 清空选中的文件
370+
const clearSelectedFile = () => {
371+
selectedFile.value = null
372+
fileList.value = []
373+
// 强制重新渲染Upload组件
374+
uploadKey.value++
375+
}
376+
370377
// 处理对话框关闭
371378
const handleCancel = () => {
372379
visible.value = false

0 commit comments

Comments
 (0)