From 1b086a491fb17c94b55a44a79a866ba613adeb5d Mon Sep 17 00:00:00 2001 From: rickcole Date: Mon, 10 Aug 2020 20:18:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4autofill=E7=9A=84=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/Image.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/renderers/Form/Image.tsx b/src/renderers/Form/Image.tsx index f9b0e215c..99438b13c 100644 --- a/src/renderers/Form/Image.tsx +++ b/src/renderers/Form/Image.tsx @@ -334,7 +334,6 @@ export default class ImageControl extends React.Component< startUpload(retry: boolean = false) { if (this.state.uploading) { - this.resolve && this.resolve(null); return; } @@ -370,6 +369,7 @@ export default class ImageControl extends React.Component< } tick() { + const {multiple, autoFill, onBulkChange} = this.props; if (this.current || !this.state.uploading) { return; } @@ -429,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 => { @@ -778,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));