Open ycshill opened 10 months ago
const beforeUpload = (file: RcFile, _: RcFile[]) => { const isSizeValid = file.size / 1024 / 1024 < 1;
if (!isSizeValid) {
formRef.current?.setFieldsValue({
descImgUrl: [],
});
message.error('只允许上传大小为1MB以内的图片');
}
return isSizeValid || Upload.LIST_IGNORE;
}; 用了 Upload.LIST_IGNORE 也不行
我也遇到了这个问题 现在解决了嘛
解决了吗 ?我也碰到了这个问题
这样写没问题
<ProFormUploadDragger
required
max={1}
width="sm"
label="Excel文件"
name="upload"
description=""
accept={'.xlsx,.xls,.xlsm,.csv'}
style={{ width: '80%' }}
fieldProps={{
beforeUpload(file, fileList) {
return false;
},
}}
/>
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
🐛 bug 描述
📷 复现步骤
🏞 期望结果
💻 复现代码
© 版本信息
"@ant-design/pro-components": "2.6.2",
🚑 其他信息