Skip to content

Commit 306e9e2

Browse files
committed
feat(TreeView): 增加 OverscanCount 支持
1 parent 3c6db07 commit 306e9e2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/BootstrapBlazor/Components/TreeView/TreeView.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ else
4747
@if (IsVirtualize)
4848
{
4949
<div class="tree-root scroll is-virtual" tabindex="0">
50-
<Virtualize ItemSize="RowHeight" OverscanCount="10" Items="@Rows">
50+
<Virtualize ItemSize="RowHeight" OverscanCount="OverscanCount" Items="@Rows">
5151
@RenderRow(context)
5252
</Virtualize>
5353
</div>

src/BootstrapBlazor/Components/TreeView/TreeView.razor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ public partial class TreeView<TItem> : IModelEqualityComparer<TItem>
224224
[Parameter]
225225
public float RowHeight { get; set; } = 38f;
226226

227+
/// <summary>
228+
/// Gets or sets the overscan count for virtual scrolling. Default is 10.
229+
/// </summary>
230+
/// <remarks>Effective when <see cref="IsVirtualize"/> is set to true.</remarks>
231+
[Parameter]
232+
public int OverscanCount { get; set; } = 10;
233+
227234
/// <summary>
228235
/// Gets or sets the toolbar content template. Default is null.
229236
/// </summary>

0 commit comments

Comments
 (0)