@@ -306,6 +306,9 @@ public partial class Tab : IHandlerException
306
306
[ NotNull ]
307
307
private IIconTheme ? IconTheme { get ; set ; }
308
308
309
+ [ Inject , NotNull ]
310
+ private DialogService ? DialogService { get ; set ; }
311
+
309
312
private ConcurrentDictionary < TabItem , bool > LazyTabCache { get ; } = new ( ) ;
310
313
311
314
private bool HandlerNavigation { get ; set ; }
@@ -792,9 +795,7 @@ private RenderFragment RenderTabItemContent(TabItem item) => builder =>
792
795
793
796
if ( item . IsActive )
794
797
{
795
- var content = _errorContent ?? item . ChildContent ;
796
- builder . AddContent ( 0 , content ) ;
797
- _errorContent = null ;
798
+ builder . AddContent ( 0 , item . ChildContent ) ;
798
799
if ( IsLazyLoadTabItem )
799
800
{
800
801
LazyTabCache . AddOrUpdate ( item , _ => true , ( _ , _ ) => true ) ;
@@ -806,19 +807,12 @@ private RenderFragment RenderTabItemContent(TabItem item) => builder =>
806
807
}
807
808
} ;
808
809
809
- private RenderFragment ? _errorContent ;
810
-
811
810
/// <summary>
812
811
/// HandlerException 错误处理方法
813
812
/// </summary>
814
813
/// <param name="ex"></param>
815
814
/// <param name="errorContent"></param>
816
- public virtual Task HandlerException ( Exception ex , RenderFragment < Exception > errorContent )
817
- {
818
- _errorContent = errorContent ( ex ) ;
819
- StateHasChanged ( ) ;
820
- return Task . CompletedTask ;
821
- }
815
+ public Task HandlerException ( Exception ex , RenderFragment < Exception > errorContent ) => DialogService . ShowErrorHandlerDialog ( errorContent ( ex ) ) ;
822
816
823
817
private IEnumerable < MenuItem > ? _menuItems ;
824
818
private MenuItem ? GetMenuItem ( string url )
0 commit comments