Browse Source
🐛 Focus input after clear input content
pull/15184/head
afc163
6 years ago
No known key found for this signature in database
GPG Key ID: 5F00908D72002306
1 changed files with
5 additions and
2 deletions
-
components/input/Input.tsx
|
|
@ -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>) => { |
|
|
|