fix(input): `v-model` modifiers not work (#3817)

* fix(input): `v-model` modifiers not work

* refactor: update
pull/3927/head
John 2021-04-11 08:27:39 +08:00 committed by GitHub
parent e95eb61bcb
commit 96709926e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -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();
},
@ -152,6 +161,7 @@ export default {
keydown: handleKeyDown,
input: handleChange,
change: noop,
blur: this.onBlur,
},
class: getInputClassName(prefixCls, size, disabled),
ref: 'input',
@ -196,6 +206,7 @@ export default {
input: this.handleChange,
keydown: this.handleKeyDown,
change: noop,
blur: this.onBlur,
},
};
return <TextArea {...textareaProps} ref="input" />;