fix: unnecessary input event on input tag placeholder in IE #92

pull/165/head
tangjinzhou 2018-08-08 10:04:46 +08:00
parent 4021693893
commit 95c9d6403f
2 changed files with 9 additions and 0 deletions

4
components/_util/env.js Normal file
View File

@ -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

View File

@ -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) {
@ -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 {