1👍
✅
You do not need for loop. Just use the index variable:
function afficherJour(index) {
const loop = Math.trunc(index / 7);
const mod = index % 7;
return mode === 0
? this.weekday[(loop) % 7]
: undefined;
}
Also, do not use index + 1
in your component template. Just pass, the index
variable to afficherJour
function from v-for
.
Source:stackexchange.com