@code{
protected DateTime BindValue { get; set; } = DateTime.Today;
private string BindValueString
{
get
{
return BindValue.HasValue ? BindValue.Value.ToString("yyyy-MM-dd") : "";
}
set
{
if (DateTime.TryParse(value, out var d))
{
BindValue = d;
}
else
{
BindValue = DateTime.Today;
}
}
}
private Task DateTimeValueChanged(DateTime? d)
{
BindValue = d;
DateTimeLogger?.Log($"选择的时间为: {d:yyyy-MM-dd}");
return Task.CompletedTask;
}
}