gpt4 book ai didi

blazor - 如何在blazor(.razor页面)中设置默认类型@typeparam TValue = bool

转载 作者:行者123 更新时间:2023-12-03 19:10:31 32 4
gpt4 key购买 nike

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

最佳答案

This is a known issue 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

关于blazor - 如何在blazor(.razor页面)中设置默认类型@typeparam TValue = bool,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60033488/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com