Merge pull request #836 from RickCole21/master

修复 image 添加 autoFill,导致表单提交一直 loading 的问题
This commit is contained in:
liaoxuezhi 2020-08-10 21:08:19 +08:00 committed by GitHub
commit 9b43a888dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -369,6 +369,7 @@ export default class ImageControl extends React.Component<
}
tick() {
const {multiple, autoFill, onBulkChange} = this.props;
if (this.current || !this.state.uploading) {
return;
}
@ -428,7 +429,16 @@ export default class ImageControl extends React.Component<
{
files: this.files = files
},
this.tick
() => {
const sendTo =
!multiple &&
autoFill &&
!isEmpty(autoFill) &&
dataMapping(autoFill, obj || {});
sendTo && onBulkChange(sendTo);
this.tick();
}
);
},
progress => {
@ -777,13 +787,6 @@ export default class ImageControl extends React.Component<
};
obj.value = obj.value || obj.url;
const sendTo =
!multiple &&
autoFill &&
!isEmpty(autoFill) &&
dataMapping(autoFill, obj);
sendTo && onBulkChange(sendTo);
cb(null, file, obj);
})
.catch(error => cb(error.message || __('上传失败,请重试'), file));