mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 12:56:13 +00:00
fix: when batch uploading, filter out unaccept files
This commit is contained in:
parent
a19311cb24
commit
3268267ccd
@ -197,11 +197,14 @@ export const Upload = connect({
|
|||||||
onChange({ fileList, file, ...others }) {
|
onChange({ fileList, file, ...others }) {
|
||||||
// console.log({fileList, file, others});
|
// console.log({fileList, file, others});
|
||||||
if (accept && !attrAccept(file, accept)) {
|
if (accept && !attrAccept(file, accept)) {
|
||||||
message.error('不支持上传当前格式的文件');
|
message.error(`「${file.name}」不支持上传的文件格式`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setFileList(fileList);
|
const fList = fileList.filter(file => {
|
||||||
const list = toValues(fileList);
|
return attrAccept(file, accept);
|
||||||
|
});
|
||||||
|
setFileList(fList);
|
||||||
|
const list = toValues(fList);
|
||||||
onChange(multiple ? list : list.shift() || null);
|
onChange(multiple ? list : list.shift() || null);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user