From 8cb46c4a8e12bc8f059397511177a645505e4579 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 18 Mar 2021 17:19:25 +0800 Subject: [PATCH 1/2] fix(input): `v-model` modifiers not work --- components/input/Input.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index 33aec9f107..227c1c6f6f 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -115,6 +115,10 @@ export default { } }, onChange(e) { + // fix this isssue: https://github.com/vueComponent/ant-design-vue/issues/3816 + // reference: https://github.com/vuejs/vue/issues/5847 and https://github.com/vuejs/vue/issues/8431 + this.$forceUpdate(); + this.$emit('change.value', e.target.value); this.$emit('change', e); this.$emit('input', e); From a107f7df642f487f3b427b7ce763004e10e2d5d4 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 19 Mar 2021 17:42:08 +0800 Subject: [PATCH 2/2] refactor: update --- components/input/Input.jsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index 227c1c6f6f..926be43e8e 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -88,6 +88,15 @@ export default { } }, methods: { + onBlur(e) { + // fix this isssue: https://github.com/vueComponent/ant-design-vue/issues/3816 + // reference: https://github.com/vuejs/vue/issues/5847 and https://github.com/vuejs/vue/issues/8431 + this.$forceUpdate(); + + const { blur } = getListeners(this); + blur && blur(e); + }, + focus() { this.$refs.input.focus(); }, @@ -115,10 +124,6 @@ export default { } }, onChange(e) { - // fix this isssue: https://github.com/vueComponent/ant-design-vue/issues/3816 - // reference: https://github.com/vuejs/vue/issues/5847 and https://github.com/vuejs/vue/issues/8431 - this.$forceUpdate(); - this.$emit('change.value', e.target.value); this.$emit('change', e); this.$emit('input', e); @@ -156,6 +161,7 @@ export default { keydown: handleKeyDown, input: handleChange, change: noop, + blur: this.onBlur, }, class: getInputClassName(prefixCls, size, disabled), ref: 'input', @@ -200,6 +206,7 @@ export default { input: this.handleChange, keydown: this.handleKeyDown, change: noop, + blur: this.onBlur, }, }; return