ant design upload组件的beforeUpload阻止默认上传行为
作者:互联网
const onImportExcel = (file) => { return new Promise(async (resolve, reject) => { ... //要执行的语句 return reject(false); //加上这个就会阻止默认上传 }); }; <Upload name="file" className="avatar-uploader" showUploadList={false} beforeUpload={onImportExcel} accept=".xlsx,.xls,.xlt" > <Button type="primary" icon={<DownloadOutlined />}> 导入 </Button> </Upload>
标签:return,upload,默认,ant,阻止,design,reject,false,上传 来源: https://www.cnblogs.com/uimeigui/p/15872367.html