[Vuejs]-Have incremented value in v-for attr

0👍

Well I found! Thanks to Max Sinev for having me here on the right track !

methods: {
  toCurrencyString(number){
    return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
  },
  tottest(elecs, index){
    return result += Math.round(elecs[index].obtenus/elecs[index].maxsiege*100);
  }
}

And in my template :

      <ul class="pie-wrapper" >
          <li v-for="(elec, index)  in elecs" :key="index" v-if="elecs[index].obtenus != 0" class="arc" :data-value="tottest(elecs, index)">
          </li>
      </ul>

Leave a comment