Skip to content

Commit

Permalink
fix:input clear时补充change事件 (baidu#9442)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Jan 17, 2024
1 parent a73b8a7 commit 006413c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/amis/src/renderers/Form/InputText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,21 @@ export default class TextControl extends React.PureComponent<
async clearValue() {
const {onChange, resetValue, dispatchEvent} = this.props;

const rendererEvent = await dispatchEvent(
const clearEvent = await dispatchEvent(
'clear',
resolveEventData(this.props, {value: resetValue})
);

if (rendererEvent?.prevented) {
if (clearEvent?.prevented) {
return;
}

const changeEvent = await dispatchEvent(
'change',
resolveEventData(this.props, {resetValue})
);

if (changeEvent?.prevented) {
return;
}

Expand Down

0 comments on commit 006413c

Please sign in to comment.