[Vuejs]-Calculate 2d array with reduce in vuejs

0👍

Your computed variable is really only one number studentTotalScore. Since you want a number for each row, this computed value should be an array studentTotalScores. Each row should have its own index.

this.form.labStudentScores[index].push(value);

And in your template you should also refer to the correct row too for calulation.

{{studentTotalScore[index]}}

Of course your compute function should also only compute values of the related row.

Leave a comment