//1st column
<div class="container-1">
<div v-for = "item2 in arrayDivs1" class="card-1" >
<q-card-main >
<div style="background">
<!--<img src="/statics/imgs/serenitea.jpg">-->
<h2>{{item2.price}}</h2>
<!--<q-card-actions>
<q-btn flat label="7:30PM" />
</q-card-actions> -->
</div>
</q-card-main>
</div>
</div>
//2nd column
<div class="container-1">
<div v-for = "item2 in arrayDivs1" class="card-1" >
<q-card-main >
<div style="background">
<!--<img src="/statics/imgs/serenitea.jpg">-->
<h2>{{item2.price}}</h2>
<!--<q-card-actions>
<q-btn flat label="7:30PM" />
</q-card-actions> -->
</div>
</q-card-main>
</div>
</div>
//3rd column
<div class="container-1">
<div v-for = "item2 in arrayDivs1" class="card-1" >
<q-card-main >
<div style="background">
<!--<img src="/statics/imgs/serenitea.jpg">-->
<h2>{{item2.price}}</h2>
<!--<q-card-actions>
<q-btn flat label="7:30PM" />
</q-card-actions> -->
</div>
</q-card-main>
</div>
</div>
//.. copy paste up to 5th column
写这个更有效的方法是什么?而不是重复编写相同的 HTML/CSS 块 5 次?
有没有我们可以用更少的代码创建这个网格布局的二维 for 循环?像:
for(var i =0;i<3; i++){
for(var j =0;j<3; j++){
//create your 2d cards here
}
}