我想在 blazor 中使用单选组,因此在实现编辑表单并选择其中一个单选按钮后出现此错误:
Microsoft.AspNetCore.Components.Forms.InputRadioGroup`1[EGameCafe.SPA.Models.GameModel] 不支持“EGameCafe.SPA.Models.GameModel”类型。
这是我的编辑表格:
<EditForm Model="ViewModel" OnValidSubmit="HandleCreateGroup">
@if (ViewModel.Games.List.Any())
{
<InputRadioGroup Name="GameSelect" @bind-Value="Gamemodelsample">
@foreach (var game in ViewModel.Games.List)
{
<InputRadio Value="game" />
@game.GameName
<br />
}
</InputRadioGroup>
}
</EditForm>
@code{
public GameModel GameModelSample { get; set; } = new();
}
和 GameModel 是:
public class GameModel
{
public string GameId { get; set; }
public string GameName { get; set; }
}