Skip to content

Commit 65a4eb5

Browse files
committed
fix: unnecessary input event on input tag placeholder in IE #92
1 parent e6054ff commit 65a4eb5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: components/_util/env.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const inBrowser = typeof window !== 'undefined'
2+
export const UA = inBrowser && window.navigator.userAgent.toLowerCase()
3+
export const isIE = UA && /msie|trident/.test(UA)
4+
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0

Diff for: components/input/Input.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import TextArea from './TextArea'
33
import omit from 'omit.js'
44
import inputProps from './inputProps'
55
import { hasProp, getComponentFromProp, getStyle, getClass } from '../_util/props-util'
6+
import { isIE, isIE9 } from '../_util/env'
67

78
function fixControlledValue (value) {
89
if (typeof value === 'undefined' || value === null) {
@@ -47,6 +48,10 @@ export default {
4748
this.$emit('keydown', e)
4849
},
4950
handleChange (e) {
51+
// https://github.com/vueComponent/ant-design-vue/issues/92
52+
if (isIE && !isIE9 && this.stateValue === e.target.value) {
53+
return
54+
}
5055
if (!hasProp(this, 'value')) {
5156
this.stateValue = e.target.value
5257
} else {

0 commit comments

Comments
 (0)