fix:input clear时补充change事件 (#9442)

This commit is contained in:
hsm-lv 2024-01-17 09:43:16 +08:00 committed by GitHub
parent a73b8a7685
commit 006413c887
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}