我们在复选框组件的 checked 属性中提供了 TValue 支持。如何在 blazor(.razor 页面(中设置默认类型@typeparam TValue = bool
@using Microsoft.AspNetCore.Components.Web;
@using Microsoft.AspNetCore.Components.Rendering
@inherits BaseComponent;
@implements ICheckBox;
@typeparam TValue = bool;
这是一个
已知问题https://github.com/dotnet/aspnetcore/issues/13619
但是我在项目中所做的解决方法是
public class DateTimePickerComponent : DateTimePickerComponent<DateTime?> { } // default Type value
public class DateTimePickerComponent<T> : BaseSubComponent { .... } // all business here
在组件 I 中,来自以下之一
@inherits DateTimePickerComponent // default type will be DateTime?
@inherits DateTimePickerComponent<DateTime> // this also work