使用余烬引导程序使行可单击



这是我的 hbs 代码的一个例子。

<div class="table-responsive">
<table class="table table-striped">
<thead>
<th>#Id</th>
<th>{{t 'firstname'}}</th>
<th>{{t 'lastname'}}</th>
<th>{{t 'email'}}</th>
<th>{{t 'username'}}</th>
</thead>
<tbody>
{{#each users as |user|}}
<tr>
<td>
{{#link-to 'profile' user.id}}
{{user.id}}
{{/link-to}}
</td>
<td>
{{#link-to 'profile' user.id}}
{{user.firstname}}
{{/link-to}}
</td>
<td>
{{#link-to 'profile' user.id}}
{{user.lastname}}
{{/link-to}}
</td>
<td>
{{#link-to 'profile' user.id}}
{{user.email}}
{{/link-to}}
</td>
<td>
{{#link-to 'profile' user.id}}
{{user.username}}
{{/link-to}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>

如您所见,此面板的每个元素都链接到相同的 profil,但我想知道是否有办法使行可点击,而不是每个元素。
这意味着我想在每个{{user.*}}之间单击,而不仅仅是在它们上,以将我发送到个人资料。我已经搜索过了,但我找不到引导和车把在一起的答案。
谢谢你的时间!

您可以将 {{link-to}} 帮助程序设置为行元素,如下所示。

{{#link-to "profile" user.id tagName = "tr"}}
<td>
<a>
{{user. firstname}}
</a>
</td>
<td>
<a>
{{user. email}}
</a>
</td>
....
{{/link-to}}

最新更新