我有下一张桌子:
<table class="table" id="calls_table">
<thead>
<tr>
<th class="round-bg header">Val1</th>
<th class="rep-bg header">Val2</th>
<th class="rep-bg header">Val3</th>
</tr>
</thead>
<tbody data-bind="template: {name: 'call-template', foreach: calls}">
</tbody>
</table>
<script type="text/html" id="call-template">
<tr class="alt">
<td><a data-bind="attr: {href: url}, text: v1" class="simp" href=""></a></td>
<td><a data-bind="attr: {href: url}, text: v2" class="simp" href=""></a></td>
<td data-bind="text: v3"></td>
</tr>
</script>
问题是如何为 TR 添加类的交替?比如:class='alt', class=''——请指教。