Skip to content

Commit

Permalink
Merge branch 'fix/vuetifyjs#5748-vtextfield-skip-update-if-ime-compos…
Browse files Browse the repository at this point in the history
…ing' of https://github.com/kouqon/vuetify into kouqon-fix/vuetifyjs#5748-vtextfield-skip-update-if-ime-composing
  • Loading branch information
johnleider committed Apr 20, 2020
2 parents c1c714e + ff0719d commit 762c06f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/vuetify/src/components/VTextField/VTextField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ interface options extends InstanceType<typeof baseMixins> {

const dirtyTypes = ['color', 'file', 'time', 'date', 'datetime-local', 'week', 'month']

interface InputEvent extends UIEvent {
isComposing: Boolean
}
interface KeyboardEvent extends UIEvent {
keyCode: Number
isComposing: Boolean
}

/* @vue/component */
export default baseMixins.extend<options>().extend({
name: 'v-text-field',
Expand Down Expand Up @@ -448,12 +456,14 @@ export default baseMixins.extend<options>().extend({
}
},
onInput (e: Event) {
const target = e.target as HTMLInputElement
this.internalValue = target.value
this.badInput = target.validity && target.validity.badInput
if (!(e as InputEvent).isComposing) {
const target = e.target as HTMLInputElement
this.internalValue = target.value
this.badInput = target.validity && target.validity.badInput
}
},
onKeyDown (e: KeyboardEvent) {
if (e.keyCode === keyCodes.enter) this.$emit('change', this.internalValue)
if (!e.isComposing && e.keyCode === keyCodes.enter) { this.$emit('change', this.internalValue) }

this.$emit('keydown', e)
},
Expand Down

0 comments on commit 762c06f

Please sign in to comment.