In my Vue component I have 3 numeric fields, like this:
data() {
return {
numberAdults: 0,
numberChildren: 0,
numberInfants: 0,
}
and also a computed property:
computed: {
numberPersons() {
return this.numberAdults + this.numberChildren + this.numberInfants
},
I want to validate that at least one person is set (at least one adult or one child or one infant), but I cannot make this to work. This is the validation rule:
numberPersons: {
required,
minValue: minValue(1),
},
If I change the numberPersons with one of the three fields, the validation for that field works. I think that somehow Vuelidate doesn't know what numberPersons is, but I am not sure how to change that.