21 lines
No EOL
759 B
Text
21 lines
No EOL
759 B
Text
@using Ljbc1994.Blazor.IntersectionObserver.API
|
|
@using Ljbc1994.Blazor.IntersectionObserver.Components
|
|
<IntersectionObserve OnChange="entry => OnChange(entry)">
|
|
<div @ref="context.Ref.Current" class="@Class">
|
|
<button @onclick="ManualLoad">Load More</button>
|
|
</div>
|
|
</IntersectionObserve>
|
|
|
|
@code {
|
|
[Parameter] [EditorRequired] public EventCallback IntersectionChange { get; set; }
|
|
[Parameter] [EditorRequired] public EventCallback ManualLoad { get; set; }
|
|
[Parameter] public string? Class { get; set; }
|
|
|
|
private async Task OnChange(IntersectionObserverEntry entry)
|
|
{
|
|
if (entry.IsIntersecting)
|
|
{
|
|
await IntersectionChange.InvokeAsync();
|
|
}
|
|
}
|
|
} |