gpt4 book ai didi

javascript - Meteor - 模板助手参数(空格键)

转载 作者:行者123 更新时间:2023-11-30 16:43:48 25 4
gpt4 key购买 nike

我需要一些关于如何解决我的问题的想法。我有以下带有表格的 html 模板。它显示 5 行,在每行的末尾(在最后一个 td 中)有一个按钮触发 Bootstrap 模式(弹出窗口)。我正在使用空格键 {{#each}} 遍历所有游标,但问题出在模式上。它只显示第一行的数据,每一行记录相同的数据。这是因为模式的 ID 对于每条记录都是相同的(它是第一个,#subsPopup)。我需要以某种方式为每一行传递不同的 ID,例如 #subsPopup{{var}}。知道我该怎么做吗?

<!-- subscribers table -->
<table class="table table-hover">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Created</th>
<th>Modified</th>
<th>Mailing lists</th>
</tr>
</thead>
<tbody>
{{#each subsList}}
<tr>
<td>{{firstName}}</td>
<td>{{lastName}}</td>
<td>{{email}}</td>
<td>{{createdDate}}</td>
<td>{{modifiedDate}}</td>
<!-- Trigger the modal (popup window) with a button -->
<td>
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#subsPopup">Show</button>
<!-- Modal -->
<div id="subsPopup" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Mailing List for <b>{{firstName}} {{lastName}}</b> ({{email}})</h4>
</div>
<div class="modal-body">
<p>{{mailLists}}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</td>
</tr>
{{/each}}
</tbody>
</table>

最佳答案

您的订阅集合可能有 _id 字段,因此您可以尝试输出 {{_id}}

关于javascript - Meteor - 模板助手参数(空格键),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31538841/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com