Javascript 如何在meteor中从一个数组创建多个表行
您好,我想知道如何使用模板助手从一个数组创建多个表行?目前,我正在获取在同一行中返回的数组中的所有图像。理想情况下,我希望每个图像在表中都有自己的行。我将如何处理这个问题Javascript 如何在meteor中从一个数组创建多个表行,javascript,arrays,templates,meteor,handlebars.js,Javascript,Arrays,Templates,Meteor,Handlebars.js,您好,我想知道如何使用模板助手从一个数组创建多个表行?目前,我正在获取在同一行中返回的数组中的所有图像。理想情况下,我希望每个图像在表中都有自己的行。我将如何处理这个问题 <template name="stop"> <tr> {{#each thumb}} <td class="image"><img src="{{this}}"></td>{{/each}} &
<template name="stop">
<tr>
{{#each thumb}}
<td class="image"><img src="{{this}}"></td>{{/each}}
<td>
</td>
</tr>
</template>
Chartdata.findOne().data;等于图像URL的数组。为什么不将数组迭代(
{{{each}}
)上移到行级别
<template name="stop">
{{#each thumb}}
<tr>
<td class="image">
<img src="{{this}}">
</td>
</tr>
{{/each}}
</template>
{{{每个拇指}
{{/每个}}
这样,数组中的每个项都将被呈现为一个新行(
)。啊,是的,我明白你的意思,但是如果我有两个模板帮助程序在同一个表行中返回不同的信息会怎么样。我如何能够输出和遍历它们,而不让它们的{{each}}语句相互干扰。
<template name="stop">
{{#each thumb}}
<tr>
<td class="image">
<img src="{{this}}">
</td>
</tr>
{{/each}}
</template>