DateTimePickerComponent

DateTimePickerComponent

我们在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;

最佳答案

这是一个已知问题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

09-07 16:54