mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:48:13 +08:00
fix: 修复input-image change 事件触发2次问题 (#4509)
Co-authored-by: liujintao03 <liujintao03@baidu.com>
This commit is contained in:
parent
7d513f806b
commit
75f3a7bd69
@ -703,7 +703,7 @@ export default class ImageControl extends React.Component<
|
||||
locked: false
|
||||
},
|
||||
() => {
|
||||
this.onChange(!!this.resolve);
|
||||
this.onChange(!!this.resolve, false);
|
||||
|
||||
if (this.resolve) {
|
||||
this.resolve(
|
||||
@ -773,7 +773,7 @@ export default class ImageControl extends React.Component<
|
||||
});
|
||||
}
|
||||
|
||||
async onChange(changeImmediately?: boolean) {
|
||||
async onChange(changeImmediately?: boolean, changeEvent: boolean = true) {
|
||||
const {
|
||||
multiple,
|
||||
onChange,
|
||||
@ -807,9 +807,11 @@ export default class ImageControl extends React.Component<
|
||||
: newValue;
|
||||
}
|
||||
|
||||
const dispatcher = await this.dispatchEvent('change');
|
||||
if (dispatcher?.prevented) {
|
||||
return;
|
||||
if (changeEvent) {
|
||||
const dispatcher = await this.dispatchEvent('change');
|
||||
if (dispatcher?.prevented) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
onChange((this.emitValue = newValue || ''), undefined, changeImmediately);
|
||||
|
Loading…
Reference in New Issue
Block a user