fix(InputImage): 细节调整 (#5964)

This commit is contained in:
刘丹 2022-12-22 18:50:05 +08:00 committed by GitHub
parent afbfe5a180
commit 2ae83e9aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -783,7 +783,7 @@ export default class ImageControl extends React.Component<
});
}
async onChange(changeImmediately?: boolean, changeEvent: boolean = true) {
async onChange(changeImmediately?: boolean, changeEvent: boolean = true, initAutoFill?: boolean) {
const {
multiple,
onChange,
@ -792,6 +792,7 @@ export default class ImageControl extends React.Component<
delimiter,
valueField
} = this.props;
const curInitAutoFill = initAutoFill ?? true;
const files = this.files.filter(
file => file.state == 'uploaded' || file.state == 'init'
@ -825,7 +826,7 @@ export default class ImageControl extends React.Component<
}
onChange((this.emitValue = newValue || ''), undefined, changeImmediately);
this.syncAutoFill();
curInitAutoFill && this.syncAutoFill();
}
syncAutoFill() {
@ -1244,7 +1245,11 @@ export default class ImageControl extends React.Component<
this.setState(
{
files: (this.files = files)
} // , !needUploading ? this.onChange : undefined
}, () => {
if (!needUploading) {
this.onChange(false, true, this.initAutoFill);
}
}
);
};
img.src = imgDom.src;