Skip to content

Commit 723b6c6

Browse files
committed
feat: input add focus when click clear button
1 parent 8820a18 commit 723b6c6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

components/input/Input.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ export default {
114114

115115
handleReset(e) {
116116
this.setValue('', e);
117+
this.$nextTick(() => {
118+
this.focus();
119+
});
117120
},
118121

119122
handleChange(e) {
@@ -123,7 +126,13 @@ export default {
123126
renderClearIcon(prefixCls) {
124127
const { allowClear, disabled } = this.$props;
125128
const { stateValue } = this;
126-
if (!allowClear || disabled || stateValue === undefined || stateValue === null || stateValue === '') {
129+
if (
130+
!allowClear ||
131+
disabled ||
132+
stateValue === undefined ||
133+
stateValue === null ||
134+
stateValue === ''
135+
) {
127136
return null;
128137
}
129138
return (

0 commit comments

Comments
 (0)