Error ​
The <Error />
component is for show error message for defined input field.
vue
<script lang="ts" setup>
import { FormifyForm, FormifyInput, Error, FormType } from 'vue-formify';
const form = ref<FormType>();
const sendForm = (data) => {
if (!data.email.length) {
form.value?.setError('email', 'Email required!');
}
};
</script>
<template>
<FormifyForm @submit="sendForm">
<FormifyInput name="email" />
<Error error-for="email" />
<button>Send</button>
</FormifyForm>
</template>
Api reference ​
Props ​
Prop | Description |
---|---|
error-for (required) | The name of the input to show the error for |
Slots ​
Slot | Parameter | Description |
---|---|---|
error | { error: string } | Customize error |