我只想显示 id="firstTr-1" 的第一个 tr,但它应该从同一个对象获取数据,其他 tr 应该有除第一个之外的数据。我应该添加任何 registryhelper 还是他们的内置帮助方法!我查看了文档,但无法弄清楚。
模板:
<script id="firsttemp" type="text/x-handlebars-template">
<tr id="firstTr-1">
<td class="tableFirstCol"><input type="checkbox" class="check" id="childcheck" /></td>
<td class="tableFirstCol"><input type="checkbox" class="star" id="childstar" /></td>
<td class="tableFirstCol"><input type="checkbox" class="alarm" id="childalarm" /></td>
<td class="tableFirstCol">Hero Honda<span>Hero Honda</span></td>
</tr>
{{#each objects}}
<tr>
<td class="tableFirstCol"><input type="checkbox" class="check" id="childcheck" /></td>
<td class="tableFirstCol"><input type="checkbox" class="star" id="childstar" /></td>
<td class="tableFirstCol"><input type="checkbox" class="alarm" id="childalarm" /></td>
<td class="tableFirstCol">{{name}}<span>{{name}}</span></td>
</tr>{{/each}}
</script>
杰森:
var company= [
{
"name": "Hero Honda",
"lastprice": 310.2,
"dayschange": 20.1,
"dayshigh": 220.9,
"volume": 140.3,
"52weekhigh": 200.3,
"name2": "herohonda",
"dataset": [1200,3000,3200],
"lastprice2": "1:10pm",
"dayschange2": "8%",
"dayshigh2": "1.5%",
"volume2": "1:10 Pm",
"52weekhigh2": "1:10 Pm"
},
{
"name": "Hero Honda",
"lastprice": 310.2,
"dayschange": 20.1,
"dayshigh": 220.9,
"volume": 140.3,
"52weekhigh": 200.3,
"name2": "herohonda",
"dataset": [3200,3500,5000],
"lastprice2": "1:10pm",
"dayschange2": "8%",
"dayshigh2": "1.5%",
"volume2": "1:10 Pm",
"52weekhigh2": "1:10 Pm"
}]