Hi, is there any way to apply validation on v-select, need this very urgently.
Yes. The docs for Vee-Validate show you can validate v-model. You must have a name attribute that matches the v-model, which in the example below is email. Then, bind that name to the validator with v-validate:email.
https://codepen.io/sagalbot/pen/qxbPLY?editors=1010
<v-select :options="options" v-model="email" v-validate:email="'required|email'" name="email"></v-select>
<span v-show="errors.has('email')" class="danger">
{{ errors.first('email') }}
</span>
Vue.component('v-select', VueSelect.VueSelect)
Vue.use(VeeValidate)
new Vue({
el: '#app',
data: {
options: [
'[email protected]',
'invalid email address',
],
email: null
}
})
I will get this added to the docs.
@sagalbot thanks for the help, but I need to set the border color of input red.
Updated the example.
Most helpful comment
Yes. The docs for Vee-Validate show you can validate
v-model. You must have anameattribute that matches thev-model, which in the example below isemail. Then, bind that name to the validator withv-validate:email.https://codepen.io/sagalbot/pen/qxbPLY?editors=1010
I will get this added to the docs.