fix: 修复多文件上传一个一个选择上传第二个文件上传失效的问题

(cherry picked from commit 7fd564307d)
pull/420/head
puhui999 2024-01-04 12:10:01 +08:00 committed by shizhong
parent 712a7df176
commit 4ddf19a601
1 changed files with 4 additions and 1 deletions

View File

@ -100,7 +100,9 @@ const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => {
//
const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => {
message.success('上传成功')
fileList.value.shift()
//
const index = fileList.value.findIndex((item) => item.response?.data === res.data)
fileList.value.splice(index, 1)
uploadList.value.push({ name: res.data, url: res.data })
if (uploadList.value.length == uploadNumber.value) {
fileList.value.push(...uploadList.value)
@ -144,6 +146,7 @@ watch(
fileList.value.push(
...val.split(',').map((url) => ({ name: url.substring(url.lastIndexOf('/') + 1), url }))
)
return
}
// 2
fileList.value.push(