【发布时间】:2022-08-15 09:34:02
【问题描述】:
我正在创建一个表来显示数据库中的项目列表,但是在使用 {{#each}} 循环时如何为列表输入序列号:
<table class=\"table mt-5\">
<thead>
<tr>
<th scope=\"col\">No.</th>
<th scope=\"col\">Title</th>
<th scope=\"col\">Category</th>
<th scope=\"col\">Description</th>
<th>Image</th>
</tr>
</thead>
<tbody>
{{#each products}}
<tr>
<th scope=\"row\">1</th>
<td>{{this.Name}}</td>
<td>{{this.Category}}</td>
<td>{{this.Description}}</td>
<td><img style=\"width:100px\" src=\"/product-images/{{this._id}}.png\" alt=\"Img\"></td>
</tr>
{{/each}}
</tbody>
</table>
这是我正在使用的表格,在我写了 1 的 th 标签中,我想用 sl 替换它。不。这是一个 .hbs 文件,我使用 Node.js 和 MongoDB 作为数据库 我将如何做?
-
什么是“sl. no.”?
-
序列号 !或者我们可以说从 1 开始的索引号。
-
我不明白,序列号是属于每个产品的属性,还是只是每一行的计数? -
1, 2, 3, ... -
是的,每一行的计数
标签: javascript html express-handlebars hbs