Migre le projet vers Blazor WebAssembly en .NET 10
This commit is contained in:
28
ChessCubing.App/Components/PageBody.razor
Normal file
28
ChessCubing.App/Components/PageBody.razor
Normal file
@@ -0,0 +1,28 @@
|
||||
@inject BrowserBridge Browser
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string? Page { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string? BodyClass { get; set; }
|
||||
|
||||
private string? _lastSignature;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await Browser.StartViewportAsync();
|
||||
}
|
||||
|
||||
var signature = $"{Page ?? string.Empty}|{BodyClass ?? string.Empty}";
|
||||
if (signature == _lastSignature)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_lastSignature = signature;
|
||||
await Browser.SetBodyStateAsync(Page, BodyClass);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user