我有一个剃须刀组件,其中包括一个简单的表,我想将其用作输入表,如下所示:
<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>
的属性,我想将其动态绑定到表,因此集合的内容将绑定到表。我必须选择哪些选项?
答案 0 :(得分:2)
@foreach(var item in AllItems)
{
<tr @key=item>
<td>@item.Name
</tr>
}
如果需要,您也可以执行<InputText @bind=item.Name/>
。