Skip to content

Commit

Permalink
fix: unnecessary input event on input tag placeholder in IE #92
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Aug 8, 2018
1 parent 4021693 commit 95c9d64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/_util/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const inBrowser = typeof window !== 'undefined'
export const UA = inBrowser && window.navigator.userAgent.toLowerCase()
export const isIE = UA && /msie|trident/.test(UA)
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0
5 changes: 5 additions & 0 deletions components/input/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TextArea from './TextArea'
import omit from 'omit.js'
import inputProps from './inputProps'
import { hasProp, getComponentFromProp, getStyle, getClass } from '../_util/props-util'
import { isIE, isIE9 } from '../_util/env'

function fixControlledValue (value) {
if (typeof value === 'undefined' || value === null) {
Expand Down Expand Up @@ -47,6 +48,10 @@ export default {
this.$emit('keydown', e)
},
handleChange (e) {
// https://github.com/vueComponent/ant-design-vue/issues/92
if (isIE && !isIE9 && this.stateValue === e.target.value) {
return
}
if (!hasProp(this, 'value')) {
this.stateValue = e.target.value
} else {
Expand Down

0 comments on commit 95c9d64

Please sign in to comment.