【发布时间】:2019-07-26 21:40:29
【问题描述】:
我正在尝试基于 checkbox 在 Blazor 中 Enable/Disable 一组 time 输入;而对于button 类型的inputs,以下解决方案有效,而对于time 类型的输入则无效:
有效的按钮输入解决方案:
<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" : "";
}
P.S.:在第一种情况下,bool 来自另一个component 的参数,所以我不绑定它。然而,在第二种情况下,它绑定到checkbox。
【问题讨论】:
标签: html blazor disabled-input