mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-02 12:07:44 +08:00
refactor(module: select): fix IDE error (#4018)
This commit is contained in:
parent
07c347b4b9
commit
bcce6df3a8
@ -11,27 +11,22 @@
|
||||
|
||||
@code
|
||||
{
|
||||
static RenderFragment<(Select<TItemValue, TItem> select, RenderFragment<TItem> itemTemplate)> selectOptionsRender = ctx =>
|
||||
@<Template>
|
||||
@{ #if NET5_0_OR_GREATER }
|
||||
@if(ctx.select.EnableVirtualization)
|
||||
{
|
||||
<Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize
|
||||
Items=@ctx.select.SortedSelectOptionItems.Where(x => !x.IsHidden).ToList()
|
||||
ChildContent="optionRender(ctx.itemTemplate)"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
<ForeachLoop
|
||||
Items=@ctx.select.SortedSelectOptionItems
|
||||
ChildContent="optionRender(ctx.itemTemplate)"/>
|
||||
RenderFragment SelectOptionsRender()
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
if(EnableVirtualization)
|
||||
{
|
||||
return @<Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize
|
||||
Items=@SortedSelectOptionItems.Where(x => !x.IsHidden).ToList()
|
||||
ChildContent="optionRender(ItemTemplate)"/>;
|
||||
}
|
||||
@{ #endif }
|
||||
</Template>;
|
||||
#endif
|
||||
|
||||
static Func<RenderFragment<TItem>, RenderFragment<SelectOptionItem<TItemValue, TItem>>> optionRender =
|
||||
return @<ForeachLoop Items=@SortedSelectOptionItems ChildContent="optionRender(ItemTemplate)" />;
|
||||
}
|
||||
|
||||
|
||||
Func<RenderFragment<TItem>, RenderFragment<SelectOptionItem<TItemValue, TItem>>> optionRender =
|
||||
itemTemplate => option =>
|
||||
@<CascadingValue Value=@itemTemplate Name="ItemTemplate">
|
||||
<CascadingValue Value="@option.InternalId" Name="InternalId">
|
||||
@ -88,7 +83,7 @@
|
||||
@{
|
||||
@if (!IsGroupingEnabled)
|
||||
{
|
||||
@selectOptionsRender((this, ItemTemplate))
|
||||
@SelectOptionsRender()
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user