我正在尝试基于 Blazor中的Enable/Disable一组输入;虽然对于以下类型的解决方案有效,但对于类型的输入则无效:timecheckboxinputsbuttontime
有效的按钮输入解决方案:
<button type="button" class="@this.SetButton"></button>
[Parameter] public bool state { get; set; }
public string SetButton() {
string result = state ? "" : "disabled";
return result;
}
尝试输入不起作用的时间:
<input bind="@IsDisabled" type="checkbox" />
<input class="@this.GetGroupState()" type="time" />
protected bool IsDisabled { get; set; }
public string GetGroupState() {
return this.IsDisabled ? "disabled" : "";
}
PS:在第一种情况下,bool它是另一个参数,component所以我不绑定它。但是,在第二种情况下,它绑定到checkbox.