【发布时间】:2021-10-26 03:51:46
【问题描述】:
我正在尝试将卡片彼此相邻显示(每行 4 张卡片)。这是我的卡片 html:
<div class="HelloWorldCard">
<div class="cardwithlink">
<div class="row">
<div class="Hellocard cardwithlink style="height: 170px;">
<a href="//www.https://www.google.com/" title="Google home page" target="">
<div class="content">
<div class="HelloTopSection" style="height: 110px;">
<div class="HelloCardTitle">{{ title }}</div>
<div class="HelloCardExcerpt">{{ description }}</div>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
<Script>
export default{
name: "HelloWordCard",
props:{
title: String,
description: String
},
};
我想在我的页面上显示大约 100 张卡片。我不能只是复制和过去这个 html 100 次,因为那会浪费时间。是否可以循环打印出这段 html 100 次?
我遇到的真正问题是卡片每行显示 1 张卡片。我试图让它们在每行显示 4 个。
【问题讨论】:
-
你可以试试 array.map() 方法吗?
-
@DanielprabhakaranN 不确定这将如何工作。可以演示吗?
-
你能提供你的代码的完整sn-p吗?喜欢codeandbox?
-
这能回答你的问题吗? Vue Js - Loop via v-for X times (in a range)
标签: javascript jquery css vue.js sass