Reputation: 25
I display an array posts:[]
, which contain a JSON
object. Everything is fine except that I can't display three columns in a row with Bootstrap. Even though I specified in the class="col-4". Here's my code.
<div class="" v-for="post of posts">
<div class="col-12 col-lg-4">
<router-link :to="'panneau/' + post['id_panneau']">
"...."
</router-link>
</div>
</div>
Upvotes: 0
Views: 59
Reputation: 667
You can update your code as given below and check:
<div class="row">
<div class="col-12 col-lg-4" v-for="post of posts">
<router-link :to="'panneau/' + post['id_panneau']">
"...."
</router-link>
</div>
</div>
Upvotes: 0
Reputation: 199
The v-for="..." property must be in the element you want to loop. In this case you are looping the first div not the one with the col-* class. Try remove the second div and add those classes to the first one.
<div class="col-12 col-lg-4" v-for="post of posts">
<router-link :to="'panneau/' + post['id_panneau']">
"...."
</router-link>
</div>
Upvotes: 1