You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
822 B
36 lines
822 B
@using blazor_lifetime.Models
|
|
|
|
@if (_isContentVisible)
|
|
{
|
|
@ChildContent
|
|
}
|
|
else
|
|
{
|
|
@if (LoadingContent != null)
|
|
{
|
|
@LoadingContent
|
|
}
|
|
}
|
|
|
|
@code{
|
|
private bool _isContentVisible = false;
|
|
|
|
[Parameter] public RenderFragment ChildContent { get; set; }
|
|
[Parameter] public RenderFragment LoadingContent { get; set; }
|
|
[Parameter] public IAsyncComponentBase Component { get; set; }
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
if (Component == null)
|
|
{
|
|
throw new Exception(nameof(Component));
|
|
}
|
|
Component.RenderChildContentAsync += OnRenderChildContentAsync;
|
|
}
|
|
|
|
protected async Task OnRenderChildContentAsync()
|
|
{
|
|
_isContentVisible = true;
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|