[Vuejs]-How to make the data values ​in vue v-simple-table add up to average?

0👍

i. first add method,

ii. then calculate the average and return.

iii. finally print the totalAverage.

totalAverage(grades) {
   var average = 0;
   for(var i = 0; i < grades.length; i++){
       average+= Number(grades[i].ggFinalgrade);
   }
   return average / grades.length;    
},

replace {{TotalAverage }} with {{ totalAverage( grade.group) }}

Leave a comment