Search code examples
vue.jsvalidationvee-validate

How to have Or between vee-validate3 rules?


i have an input that its value can be username or email consider this:

<ValidationProvider name="email" rules="username || email"    v-slot="{ errors, valid }">
  <v-text-field
    v-model="something"
    :error-messages="errors"
    :success="valid"
    label="E-mail or userName"
    required
  ></v-text-field>
</ValidationProvider>

I need Or between rules. if one of them match pass the input.

rules="username or email" how to achieve this in vee-validate3?


Solution

  • I found there is no or in vee validation in case you want to or something you have to write custom validator and in the logic of the custom validation you are free to do anything.