67 lines
2.4 KiB
Plaintext
67 lines
2.4 KiB
Plaintext
@using Moonlight.App.Extensions
|
|
@inherits LayoutComponentBase
|
|
@inject IJSRuntime JS
|
|
@inject NavigationManager NavigationManager
|
|
|
|
@Body
|
|
|
|
<script suppress-error="BL9992">
|
|
window.emptyBody = function(){
|
|
document.body.className = '';
|
|
}
|
|
</script>
|
|
|
|
@code
|
|
{
|
|
protected override void OnAfterRender(bool firstRender)
|
|
{
|
|
JS.InvokeVoidSafe("KTThemeMode.init");
|
|
JS.InvokeVoidSafe("emptyBody");
|
|
|
|
if (firstRender)
|
|
{
|
|
JS.InvokeVoidSafe("scrollTo", 0, 0);
|
|
JS.InvokeVoidSafe("KTDialer.init");
|
|
JS.InvokeVoidSafe("KTDrawer.init");
|
|
JS.InvokeVoidSafe("KTMenu.init");
|
|
JS.InvokeVoidSafe("KTImageInput.init");
|
|
JS.InvokeVoidSafe("KTPasswordMeter.init");
|
|
JS.InvokeVoidSafe("KTScroll.init");
|
|
JS.InvokeVoidSafe("KTScrolltop.init");
|
|
JS.InvokeVoidSafe("KTSticky.init");
|
|
JS.InvokeVoidSafe("KTSwapper.init");
|
|
JS.InvokeVoidSafe("KTToggle.init");
|
|
JS.InvokeVoidSafe("KTMenu.updateByLinkAttribute", $"/{NavigationManager.ToBaseRelativePath(NavigationManager.Uri)}");
|
|
}
|
|
|
|
JS.InvokeVoidAsync("KTLayoutSearch.init");
|
|
JS.InvokeVoidAsync("KTAppSidebar.init");
|
|
}
|
|
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
NavigationManager.LocationChanged += OnLocationChanged;
|
|
}
|
|
|
|
private async void OnLocationChanged(object sender, LocationChangedEventArgs args)
|
|
{
|
|
await JS.InvokeVoidSafeAsync("scrollTo", 0, 0);
|
|
await JS.InvokeVoidSafeAsync("KTDrawer.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTMenu.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTImageInput.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTPasswordMeter.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTScroll.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTScrolltop.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTSticky.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTSwapper.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTToggle.createInstances");
|
|
await JS.InvokeVoidSafeAsync("KTMenu.updateByLinkAttribute", $"/{NavigationManager.ToBaseRelativePath(args.Location)}");
|
|
await JS.InvokeVoidSafeAsync("KTAppSidebar.init");
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
NavigationManager.LocationChanged -= OnLocationChanged;
|
|
}
|
|
} |