Answer the question
In order to leave comments, you need to log in
How to animate error message in Vue js form?
Good day. The essence of the question is that there is a form on a one-page that pops up in a modal window.
The form was created using the Vue library (because there is a desire to master it), but due to my little experience I can’t “cut down” one “feature”, but I really want to.
To the point:
form component code (partially because it's embarrassing to show that I "got it wrong" there)
<template>
//create an animation of the appearance - the disappearance of the form
<transition name="fade"
enter-active-class="animated bounceInUp"
leave-active-class="animated bounceOutRight"
>
.... //here is the form code
// пример одного поля
<div class="row">
<div class="input-field " :class="{'wrong-input': isWrongName}">
<i class="material-icons prefix small">child_care</i>
<input class="input" type="text" id="name" name="name" v-model="name" @change="nameValidation">
<span v-if="errorMessages.poorName">{{errorMessages.poorName}}</span>
<label for="name">Ваше имя:</label>
</div>
</div>
....//here too the code
</transition>
</template>
nameValidation () {
if(this.name.length < 2){
this.isWrongName = true;
this.errorMessages.poorName = errorMessagesLocale[locale].poorName;
}else{
this.isWrongName = false;
this.errorMessages.poorName = '';
}
}
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