Skip to content

Commit c936a61

Browse files
committed
refactor: 移除 RenderTemplate 提高性能
1 parent 39d89de commit c936a61

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/BootstrapBlazor/Components/EditorForm/EditorForm.razor

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@
33
@inherits BootstrapComponentBase
44

55
<div class="@ClassString">
6-
<CascadingValue Value="@_editorItems" IsFixed="true">
6+
<CascadingValue Value="@_editorItems" IsFixed="false">
77
@FieldItems?.Invoke(Model)
88
</CascadingValue>
99
<CascadingValue Value="this" Name="EditorForm">
10-
<RenderTemplate>
11-
@if (ShowUnsetGroupItemsOnTop)
10+
@if (ShowUnsetGroupItemsOnTop)
11+
{
12+
if (UnsetGroupItems.Any())
1213
{
13-
if (UnsetGroupItems.Any())
14-
{
15-
@RenderUnsetGroupItems
16-
}
17-
@foreach (var g in GroupItems)
18-
{
19-
@RenderGroupItems(g)
20-
}
14+
@RenderUnsetGroupItems
2115
}
22-
else
16+
@foreach (var g in GroupItems)
2317
{
24-
@foreach (var g in GroupItems)
25-
{
26-
@RenderGroupItems(g)
27-
}
28-
if (UnsetGroupItems.Any())
29-
{
30-
@RenderUnsetGroupItems
31-
}
18+
@RenderGroupItems(g)
19+
}
20+
}
21+
else
22+
{
23+
@foreach (var g in GroupItems)
24+
{
25+
@RenderGroupItems(g)
26+
}
27+
if (UnsetGroupItems.Any())
28+
{
29+
@RenderUnsetGroupItems
3230
}
33-
</RenderTemplate>
31+
}
3432
</CascadingValue>
3533

3634
@if (Buttons != null)

0 commit comments

Comments
 (0)