Answer the question
In order to leave comments, you need to log in
How to implement validation with vuelidate?
Attached the handler to the form
<form @submit.prevent="checkForm">
methods: {
checkForm() {
this.$v.form.$touch();
if (!this.$v.form.$error) {
console.log("Валидация прошла успешно");
}
},
},
<script>
import useVuelidate from "@vuelidate/core";
import { required, email } from "@vuelidate/validators";
export default {
name: "App",
setup() {
return { v$: useVuelidate() };
},
validations() {
return {
form: {
surname: {},
name: { required },
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question