From 723b6c6cf64122655cf68bce88bd3ca7a7cdf94b Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Thu, 17 Oct 2019 19:26:58 +0800 Subject: [PATCH] feat: input add focus when click clear button --- components/input/Input.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index cfa91549d..b0315a64a 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -114,6 +114,9 @@ export default { handleReset(e) { this.setValue('', e); + this.$nextTick(() => { + this.focus(); + }); }, handleChange(e) { @@ -123,7 +126,13 @@ export default { renderClearIcon(prefixCls) { const { allowClear, disabled } = this.$props; const { stateValue } = this; - if (!allowClear || disabled || stateValue === undefined || stateValue === null || stateValue === '') { + if ( + !allowClear || + disabled || + stateValue === undefined || + stateValue === null || + stateValue === '' + ) { return null; } return (