From abd1b7f499a5f5f7ac2fbaf3a36f6d6e2820a862 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Fri, 8 May 2020 14:24:44 +0800 Subject: [PATCH] fix: input not work at firefox && sogou #2151 --- components/input/Input.jsx | 3 +++ components/input/TextArea.jsx | 3 +++ components/vc-tabs/src/InkTabBarNode.jsx | 2 +- components/vc-tabs/src/ScrollableTabBarNode.jsx | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index 877b1c98aa..5fa4f84d2e 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -173,6 +173,9 @@ export default { }); }, handleChange(e) { + if (e.inputType === 'insertCompositionText') { + return; + } const { value, composing } = e.target; // https://github.com/vueComponent/ant-design-vue/issues/2203 if ((composing && this.lazy) || this.stateValue === value) return; diff --git a/components/input/TextArea.jsx b/components/input/TextArea.jsx index 88a77f42c4..883f7578bc 100644 --- a/components/input/TextArea.jsx +++ b/components/input/TextArea.jsx @@ -69,6 +69,9 @@ export default { this.$emit('input', e); }, handleChange(e) { + if (e.inputType === 'insertCompositionText') { + return; + } const { value, composing } = e.target; if ((composing && this.lazy) || this.stateValue === value) return; diff --git a/components/vc-tabs/src/InkTabBarNode.jsx b/components/vc-tabs/src/InkTabBarNode.jsx index a6ff2b178f..c786cc9c33 100644 --- a/components/vc-tabs/src/InkTabBarNode.jsx +++ b/components/vc-tabs/src/InkTabBarNode.jsx @@ -98,7 +98,7 @@ export default { activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), }, updated() { - setTimeout(() => { + this.$nextTick(function() { componentDidUpdate(this); }); }, diff --git a/components/vc-tabs/src/ScrollableTabBarNode.jsx b/components/vc-tabs/src/ScrollableTabBarNode.jsx index 40a6296f23..6282e96646 100644 --- a/components/vc-tabs/src/ScrollableTabBarNode.jsx +++ b/components/vc-tabs/src/ScrollableTabBarNode.jsx @@ -52,7 +52,7 @@ export default { }, updated() { - setTimeout(() => { + this.$nextTick(() => { this.updatedCal(this.prevProps); this.prevProps = { ...this.$props }; });