Answer the question
In order to leave comments, you need to log in
Minimum value in vue.js array?
https://codepen.io/anon/pen/REYYyg?editors=1010
There is a first goal, second, third and fourth.
For each goal that is divided into tasks, the user can select a maximum of 100.
How can I make sure that when the choice is less than 100, the submit button (sending the form) does not appear or is not active?
That is, min 100 and max 100. And show that a specific goal is not completely set (by some text message)
Answer the question
In order to leave comments, you need to log in
when choosing less than 100, the submit button (submitting the form) did not appear or was not active?
methods: {
notAchieved(goal) {
return goal.tasks.reduce((acc, n) => acc + n.value, 0) !== 100;
},
},
computed: {
notAllGoalsAchieved() {
return this.goals.some(this.notAchieved);
},
},
<span v-show="notAchieved(g)">не достигнута</span>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question