I have created a component called Month where I pass some props:
<template>
<select :id="id" :name="id" :class="extraClasses" :v-validate="{required: req}">
<option v-if="def" selected disabled :value="null">{{def}}</option>
<option v-if="!def" selected disabled :value="null">Month</option>
<option v-for="(month, index) in months" :key="index" :value="pad(index)">{{month}}</option>
</select>
</template>
They all work correctly if I call it with something such as:
<Month id="dob_month" extraClasses="month" def="Initial month" />
However when I try to pass the validation part VeeValidate seems to ignore it:
<Month id="dob_month" req="true" />
Is there a way I can pass the validation to the children without using a message bus so that I can do something similar to this in the parent:
<fieldset id="dob" :class="{'has-error': errors.has('dob_day') || errors.has('dob_month') || errors.has('dob_year') }">
<legend class="a-required">Date of Birth</legend>
<input type="hidden" id="date_of_birth" name="date_of_birth" />
<select id="dob_day" name="dob_day" v-validate="'required'">
<option selected disabled value="">Day</option>
<option v-for="day in monthDays" :key="day" :value="day">{{day}}</option>
</select>
<Month id="dob_month" req=true />
<Year id="dob_year" req="true" />
</fieldset>
Or will I not be able to get errors populated/propagated correctly between parent and child?
<Month id="dob_month" req="true" />
and the child component has:<select :id="id" :name="id" :class="extraClasses" :v-validate="{required: req}">
however it doesn't seem to actually pay attention to the req prop – echodrome