From abd902acd2370c59efcf98599595e97202e812a1 Mon Sep 17 00:00:00 2001 From: msidolphin Date: Mon, 12 Jul 2021 11:03:00 +0800 Subject: [PATCH] fix: upload file-list is updated but without re-rendered (#2405) (#2460) --- packages/upload/src/upload-list.vue | 2 +- packages/upload/src/useHandlers.ts | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/upload/src/upload-list.vue b/packages/upload/src/upload-list.vue index 1deba09cf2..bb1595ec5f 100644 --- a/packages/upload/src/upload-list.vue +++ b/packages/upload/src/upload-list.vue @@ -10,7 +10,7 @@ >
  • { - let cachedFiles: UploadFile[] = [] const uploadFiles = ref([]) const uploadRef = ref(null) @@ -131,18 +129,14 @@ export default (props: IUseHandlersProps) => { }) watch(() => props.fileList, (fileList: UploadFile[]) => { - if(!isEqual(cachedFiles, fileList)){ - cachedFiles = [] - uploadFiles.value = fileList.map(file => { - const cloneFile = cloneDeep(file) - cachedFiles.push(cloneFile) - return { - ...cloneFile, - uid: file.uid || genUid(tempIndex++), - status: file.status || 'success', - } - }) - } + uploadFiles.value = fileList.map(file => { + const cloneFile = cloneDeep(file) + return { + ...cloneFile, + uid: file.uid || genUid(tempIndex++), + status: file.status || 'success', + } + }) }, { immediate: true, deep: true,