I want to start the range from 0 instead of 1 in v-for="n in 10"
which results in 1 2 3 .... 10
Is there a way to do it in Vuejs?
You can use index (i
) instead of value (n
), it will start with 0
:
<div v-for="(n, i) in 10">{{ i }}</div>
Output:
0 1 2 ...
You can also just subtract a value from your integer
<div v-for="n in 10"> {{ n - 1 }} </div>
This way you can have numbers with a negative value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With