我们在Checkbox组件的checked属性中提供了TValue支持。如何在blazor(.razor页面)中设置默认类型@typeparam TValue = bool
@using Microsoft.AspNetCore.Components.Web;
@using Microsoft.AspNetCore.Components.Rendering
@inherits BaseComponent;
@implements ICheckBox;
@typeparam TValue = bool;
答案 0 :(得分:1)
但是我在项目中所做的解决方法是
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