Tobi696
Tobi696

Reputation: 458

Vuejs v-for without JSON object

I simply want to loop the numbers from 0 to 19 using a v-for attribute.

I already tried this:
<div v-for="number in [...Array(6).keys()]" v-bind:key="number">

And this:
<div v-for="let i = 0; i < 20; i++" v-bind:key="i">

Of course I could just use an array with all numbers, but I think there is a better way to do this.

Upvotes: 0

Views: 621

Answers (1)

Boussadjra Brahim
Boussadjra Brahim

Reputation: 1

You could loop through a fixed n number like :

 <div v-for="i in 20" v-bind:key="i">

Upvotes: 1

Related Questions