File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
src/BootstrapBlazor/Components/TreeView Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 66
77@if (Items == null )
88{
9- if (ShowSkeleton )
9+ if (_init )
10+ {
11+
12+ }
13+ else if (ShowSkeleton )
1014 {
1115 <SkeletonTree AdditionalAttributes =" AdditionalAttributes" ></SkeletonTree >
1216 }
Original file line number Diff line number Diff line change @@ -315,6 +315,8 @@ public partial class TreeView<TItem> : IModelEqualityComparer<TItem>
315315 . AddClass ( item . CssClass )
316316 . Build ( ) ;
317317
318+ private bool _init ;
319+
318320 /// <summary>
319321 /// <inheritdoc/>
320322 /// </summary>
@@ -377,6 +379,13 @@ protected override async Task OnParametersSetAsync()
377379 // 设置 ActiveItem 默认值
378380 ActiveItem ??= Items . FirstOrDefaultActiveItem ( ) ;
379381 ActiveItem ? . SetParentExpand < TreeViewItem < TItem > , TItem > ( true ) ;
382+ _init = true ;
383+ }
384+ else
385+ {
386+ _rows = null ;
387+ TreeNodeStateCache . Reset ( ) ;
388+ ActiveItem = null ;
380389 }
381390 }
382391
Original file line number Diff line number Diff line change @@ -26,6 +26,13 @@ public void Items_Ok()
2626 pb . Add ( a => a . Items , TreeFoo . GetTreeItems ( ) ) ;
2727 } ) ;
2828 cut . Contains ( "li" ) ;
29+
30+ cut . SetParametersAndRender ( pb =>
31+ {
32+ pb . Add ( a => a . Items , null ) ;
33+ pb . Add ( a => a . ShowSkeleton , false ) ;
34+ } ) ;
35+ Assert . Equal ( "" , cut . Markup ) ;
2936 }
3037
3138 [ Fact ]
You can’t perform that action at this time.
0 commit comments