Skip to content

Commit

Permalink
feat(v-input): check error state from vee-validate errorMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed May 10, 2022
1 parent 9d4b02a commit f4d6494
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/input/src/VInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ const sizeClass = computed(() => {
return sizes[props.size];
});
const {value: inputValue, errorMessage} = useField(props.name, props.rules, {
initialValue: props.modelValue || props.value,
});
const inputVariantClass = computed(() => {
if (props.error) {
return 'border-error-500 focus:ring-error-500 focus:ring-opacity-50 focus:border-error-500 placeholder:text-error-500';
if (props.error || errorMessage.value) {
return 'border-error-500 focus:ring-error-500 focus:ring-opacity-50 focus:border-error-500';
} else {
const variants: Record<string, string> = {
default:
Expand All @@ -124,10 +128,6 @@ const inputVariantClass = computed(() => {
return variants[props.color];
}
});
const {value: inputValue, errorMessage} = useField(props.name, props.rules, {
initialValue: props.modelValue || props.value,
});
</script>

<template>
Expand Down

0 comments on commit f4d6494

Please sign in to comment.