Browse Source

update upload list logic

pull/344/head
afc163 9 years ago
parent
commit
7d82eccb41
  1. 17
      components/upload/index.jsx

17
components/upload/index.jsx

@ -30,26 +30,27 @@ const AntUpload = React.createClass({
};
},
onStart(file) {
let targetItem;
let nextFileList = this.state.fileList.concat();
if (file.length > 0) {
file = file.map(function(f) {
targetItem = file.map(function(f) {
f = fileToObject(f);
f.status = 'uploading';
return f;
});
nextFileList = nextFileList.concat(file);
} else {
file = fileToObject(file);
file.status = 'uploading';
nextFileList.push(file);
targetItem = fileToObject(file);
targetItem.status = 'uploading';
nextFileList.push(targetItem);
}
this.onChange({
file: file,
file: targetItem,
fileList: nextFileList
});
},
removeFile(file) {
let fileList = this.state.fileList.concat();
let fileList = this.state.fileList;
let targetItem = getFileItem(file, fileList);
let index = fileList.indexOf(targetItem);
if (index !== -1) {
@ -69,7 +70,7 @@ const AntUpload = React.createClass({
this.onError(new Error('No response'), response, file);
return;
}
let fileList = this.state.fileList.concat();
let fileList = this.state.fileList;
let targetItem = getFileItem(file, fileList);
//
if (targetItem) {
@ -77,7 +78,7 @@ const AntUpload = React.createClass({
targetItem.response = response;
this.onChange({
file: targetItem,
fileList: this.state.fileList
fileList: fileList
});
}
},

Loading…
Cancel
Save