错误:
组件"MatTable"的子内容元素"MatTableRow"使用与封闭子内容元素相同的参数名称("上下文")组件"AuthorizeView"的"Authorized"。
代码:
<AuthorizeView>
<Authorized>
<h3>Products</h3>
<MatTable Items="@sortedData" class="mat-elevation-z5" ShowPaging="false" UseSortHeaderRow="true" Striped="true"
FilterByColumnName="Label" DebounceMilliseconds="150" AllowSelection="true" SelectionChanged="SelectionChangedEvent">
<MatTableHeader>
<MatSortHeaderRow SortChanged="@SortData">
<MatSortHeader SortId="Label"><span style="width:600px">Label</span></MatSortHeader>
<MatSortHeader SortId="UseCases">Use cases</MatSortHeader>
</MatSortHeaderRow>
</MatTableHeader>
<MatTableRow>
<td>@context.Label</td>
<td>@context.UseCases</td>
</MatTableRow>
</MatTable>
</Authorized>
</AuthorizeView>
通过如下参数指定上下文来解决问题:
<MatTableRow Context="tableRowContext">
<td>@tableRowContext.Label</td>
<td>@tableRowContext.UseCases</td>
</MatTableRow>