Skip to content

Commit

Permalink
fix(VTextField): update model value immediately on input event
Browse files Browse the repository at this point in the history
fixes #11243
  • Loading branch information
KaelWD committed Jul 13, 2022
1 parent f5823f7 commit 0ea08f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/vuetify/src/components/VTextField/VTextField.tsx
Expand Up @@ -125,6 +125,9 @@ export const VTextField = genericComponent<new <T>() => {
emit('click:clear', e)
})
}
function onInput (e: Event) {
model.value = (e.target as HTMLInputElement).value
}

useRender(() => {
const hasCounter = !!(slots.counter || props.counter || props.counterValue)
Expand Down Expand Up @@ -200,7 +203,8 @@ export const VTextField = genericComponent<new <T>() => {

<input
ref={ inputRef }
v-model={ model.value }
value={ model.value }
onInput={ onInput }
v-intersect={[{
handler: onIntersect,
}, null, ['once']]}
Expand Down
6 changes: 5 additions & 1 deletion packages/vuetify/src/components/VTextarea/VTextarea.tsx
Expand Up @@ -128,6 +128,9 @@ export const VTextarea = defineComponent({
emit('click:clear', e)
})
}
function onInput (e: Event) {
model.value = (e.target as HTMLTextAreaElement).value
}

const sizerRef = ref<HTMLTextAreaElement>()
function calculateInputHeight () {
Expand Down Expand Up @@ -226,7 +229,8 @@ export const VTextarea = defineComponent({
<textarea
ref={ textareaRef }
class={ fieldClass }
v-model={ model.value }
value={ model.value }
onInput={ onInput }
v-intersect={[{
handler: onIntersect,
}, null, ['once']]}
Expand Down

0 comments on commit 0ea08f8

Please sign in to comment.