0
我試圖從數組中生成兩個表。Handlebars js,獲取特定的對象數組並循環遍歷
"tables": [
{
"tableName": "table1",
"dataRow": ["name": "test858"]
},
{
"tableName": "table2",
"anotherRow": ["name": "test123"]
}
]
我試着這樣做
{{#each tables}}
<table>
<thead>
<tr>
<th>{{tableName}}</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
{{#if dataRow}}
<td>test1</td>
{{else}}
<td>test2</td>
{{/if}}
</tr>
</tbody>
</table>
{{/each}}
此打印兩個表名和 「測試2」
我如何遍歷兩個陣列?