M K*_*M K 6 blazor blazor-server-side
我们在 Checkbox 组件的 selected 属性中提供了 TValue 支持。如何在 blazor(.razor page) 中设置默认类型 @typeparam TValue = bool
@using Microsoft.AspNetCore.Components.Web;
@using Microsoft.AspNetCore.Components.Rendering
@inherits BaseComponent;
@implements ICheckBox;
@typeparam TValue = bool;
Run Code Online (Sandbox Code Playgroud)
但我在项目中所做的工作是
public class DateTimePickerComponent : DateTimePickerComponent<DateTime?> { } // default Type value
public class DateTimePickerComponent<T> : BaseSubComponent { .... } // all business here
Run Code Online (Sandbox Code Playgroud)
在组件 I 中继承自其中之一
@inherits DateTimePickerComponent // default type will be DateTime?
@inherits DateTimePickerComponent<DateTime> // this also work
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1983 次 |
| 最近记录: |