When I use a static attribute, validation errors appear as expected:
<input type="number" name="phone" v-validate="'required|digits:10'">
<span>{{ errors.first(propertyName) }}</span>
But what if I don't want to hardcode the validation rules in the JavaScript? I would think this would work:
<input type="number" name="phone" :v-validate="phone.rules">
<span>{{ errors.first(propertyName) }}</span>
But no validation errors are appearing. Any ideas what I'm doing wrong?
I have created jsFiddle and everything seems to work fine. Feel free to check: https://jsfiddle.net/m67d8f4x/2032/
<input type="email" name="email" placeholder="Email" v-validate="rules.rule" v-model="email">
// js
data() {
return {
rules: { rule: 'required' },
email: ''
}
},