feat: 优化文件上传逻辑,确保更新的文件 ID 不为空
This commit is contained in:
@@ -102,13 +102,12 @@ async function handleCustomRequest({ file, onProgress, onFinish, onError }: Uplo
|
||||
onProgress({ percent });
|
||||
}
|
||||
});
|
||||
|
||||
// 直接修改 file 对象的 id,NaiveUI 会自动同步到 fileList
|
||||
file.id = fileId;
|
||||
file.status = 'finished';
|
||||
file.url = fileId;
|
||||
|
||||
const newFileIds = [...props.modelValue, fileId];
|
||||
const newFileIds = [...props.modelValue, fileId].filter(Boolean);
|
||||
emit('update:modelValue', newFileIds);
|
||||
|
||||
onFinish();
|
||||
|
||||
Reference in New Issue
Block a user