Answer the question
In order to leave comments, you need to log in
How to check that all items have been selected?
Suppose I have many view sections:
data:
{
user_input_1 :
{
isFilled : false,
val_1 : null,
val_2 :null,
val_3 : null,
},
user_input_2 :
{
isFilled : false,
val_1 : null,
val_2 :null,
val_3 : null,
},
}
computed :
{
// как-то тут перебирать все и выставлять флаг заполненности
}
Answer the question
In order to leave comments, you need to log in
Collect all user_input_* into one object (user_inputs, for example), and then you can do this:
computed: {
isFilledAll() {
return Object.values(this.user_inputs).every(n => n.isFilled);
},
},
isFilledAll() {
return Object.values(this.user_inputs).every(n => Object.values(n).every(m => m !== null));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question