【发布时间】:2018-04-05 15:03:23
【问题描述】:
我已经让 VueJS v-for 工作正常:
<tr v-for="request in requests">
<td>{{request.name}}</td>
<td> .. etc .. </td>
</tr>
现在我需要添加一个图例/引导行,比如每 25 或 50 条记录,如下所示:
<span v-for="(request, index) in requests">
<tr>
<td>{{request.name}}</td>
<td> .. etc .. </td>
</tr>
<tr v-if="index % 25 == 0">
<th>Name</th>
<th> .. etc .. </th>
</tr>
</span>
令我惊讶的是,不仅v-if 部分不起作用,而且我返回一个错误:“ReferenceError: request is not defined”(即使我离开了v-if 指令,甚至删除了额外的@ 987654326@ 完全),所以 VueJS 正在考虑 DOM 结构,也许我还不明白。
不管怎样,我该怎么做?
顺便问一下,有没有纯 HTML/CSS 的方式来做到这一点?
【问题讨论】: