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.
31 lines
953 B
31 lines
953 B
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using blazor_lifetime.Models;
|
|
|
|
namespace blazor_lifetime.Shared
|
|
{
|
|
public class AdvancedComponentBase : OwningComponentBase, IAsyncComponentBase
|
|
{
|
|
[Parameter] public virtual RenderFragment ChildContent { get; set; }
|
|
public RenderHandleAsync RenderChildContentAsync { get; set; }
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
{
|
|
await OnComponentMountAsync().ConfigureAwait(false);
|
|
if (RenderChildContentAsync != null)
|
|
{
|
|
await RenderChildContentAsync();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
await Task.CompletedTask;
|
|
}
|
|
}
|
|
|
|
protected virtual Task OnComponentMountAsync()
|
|
=> Task.CompletedTask;
|
|
}
|
|
}
|