NaiveUI上传组件重复上传的问题
问题描述
使用自定义上传后每次新上传文件都会带着之前的文件一起上传
解决方式:
在文件上传成功时手动调用onFinish
代码示例
async function upload({ file, onFinish, onError }: UploadCustomRequestOptions) {
const res = await uploadFile(file.file as File, file.name).catch((error) => {
message.error('文件上传失败');
onError();
throw new Error(error);
});
message.success('文件上传成功');
onFinish();
}
NaiveUI上传组件重复上传的问题
http://xuyuanhang.com//archives/naiveuishang-chuan-zu-jian-chong-fu-shang-chuan-de-wen-ti