我有一个剃刀组件,包括一个简单的表,我想用它作为输入表,如下所示:
<label for="dependencies">Abhängigkeiten</label>
<table class="table table-striped">
<tr>
<th scope="col">Name</th>
<th scope="col">Version</th>
<th scope="col">Entfernen</th>
</tr>
</table>
在代码部分中,我有一个类型为IEnumerable<T>
的属性,我希望将其动态绑定到表,因此集合的内容将绑定到表。我必须选择哪些选项?
@foreach(var item in AllItems)
{
<tr @key=item>
<td>@item.Name
</tr>
}
如果需要,你也可以做<InputText @bind=item.Name/>
。