mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
🐛 Focus input after clear input content
This commit is contained in:
parent
5cd5d1ff00
commit
1b713c94e6
@ -142,9 +142,10 @@ class Input extends React.Component<InputProps, any> {
|
||||
setValue(
|
||||
value: string,
|
||||
e: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLElement, MouseEvent>,
|
||||
callback?: () => void,
|
||||
) {
|
||||
if (!('value' in this.props)) {
|
||||
this.setState({ value });
|
||||
this.setState({ value }, callback);
|
||||
}
|
||||
const { onChange } = this.props;
|
||||
if (onChange) {
|
||||
@ -167,7 +168,9 @@ class Input extends React.Component<InputProps, any> {
|
||||
}
|
||||
|
||||
handleReset = (e: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
||||
this.setValue('', e);
|
||||
this.setValue('', e, () => {
|
||||
this.focus();
|
||||
});
|
||||
};
|
||||
|
||||
handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
|
Loading…
Reference in New Issue
Block a user