mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
Fix upload beforeUpload, close #3001
This commit is contained in:
parent
472821013c
commit
c897243d33
@ -12,6 +12,7 @@ import { Upload, Button, Icon, message } from 'antd';
|
||||
|
||||
const props = {
|
||||
action: '/upload.do',
|
||||
multiple: true,
|
||||
beforeUpload(file) {
|
||||
const isJPG = file.type === 'image/jpeg';
|
||||
if (!isJPG) {
|
||||
|
@ -84,8 +84,6 @@ export default class Upload extends React.Component {
|
||||
}
|
||||
|
||||
onStart = (file) => {
|
||||
if (this.recentUploadStatus === false) return;
|
||||
|
||||
let targetItem;
|
||||
let nextFileList = this.state.fileList.concat();
|
||||
if (file.length > 0) {
|
||||
@ -182,11 +180,6 @@ export default class Upload extends React.Component {
|
||||
this.handleRemove(targetItem);
|
||||
}
|
||||
|
||||
beforeUpload = (file) => {
|
||||
this.recentUploadStatus = this.props.beforeUpload(file);
|
||||
return this.recentUploadStatus;
|
||||
}
|
||||
|
||||
handleRemove(file) {
|
||||
let fileList = this.removeFile(file);
|
||||
if (fileList) {
|
||||
@ -242,7 +235,7 @@ export default class Upload extends React.Component {
|
||||
onError: this.onError,
|
||||
onProgress: this.onProgress,
|
||||
onSuccess: this.onSuccess,
|
||||
beforeUpload: this.beforeUpload,
|
||||
beforeUpload: this.props.beforeUpload,
|
||||
};
|
||||
let uploadList;
|
||||
if (this.props.showUploadList) {
|
||||
|
Loading…
Reference in New Issue
Block a user