Skip to content

Commit

Permalink
fix(VInput): change initial value priority to v model
Browse files Browse the repository at this point in the history
  • Loading branch information
gretchelin authored and gravitano committed Jan 13, 2023
1 parent 73d0031 commit 9c9834b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/forms/src/input/VInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ const isEagerValidation = computed(() => {
});
const input = ref();
const initialValue = ref(props.modelValue || props.value);
const uncontrolledValue = ref(initialValue.value);
const {
value: vvValue,
Expand All @@ -198,6 +196,9 @@ const {
validateOnValueUpdate: !isEagerValidation.value,
});
const initialValue = ref(props.modelValue || props.value);
const uncontrolledValue = ref(initialValue.value || (name?.value ? meta.initialValue : initialValue.value));
watch(modelValue, (val) => {
uncontrolledValue.value = val;
});
Expand Down Expand Up @@ -253,11 +254,6 @@ const clear = () => {
emit('clear');
input.value?.focus();
};
// if name is defined, we override uncontrolledValue with initialValue from veeValidate
if (name.value) {
uncontrolledValue.value = meta.initialValue || '';
}
</script>

<template>
Expand Down

0 comments on commit 9c9834b

Please sign in to comment.