0
votes

I want to add a class (border 1px solid #ff0000) to an input element if there is an error. Like:

Error:

errors.has(name)

Input:

<input v-validate="validate" v-on:input="updateValue($event)" :type="type" :placeholder="placeholder"
               :name="name" :value="value" :class="classname" :id="id">

How can i achieve that?

1

1 Answers

1
votes

Bind your class with an errors.has condition

<input v-validate="validate" :name="name" :class="{'classname': errors.has(name)}">