我试图利用Maui Blazor Ad App申请。 我如何使用 app子档案? 我利用国际法学家委员会(JSRuntime)和IJSObject Reference进行了尝试,但似乎无法工作。
My project: enter image description here My code: enter image description here
@inherits LayoutComponentBase
@using Microsoft.JSInterop
<div class="page">
<main>
<article class="content px-4" style="padding: 0 !important">
@Body
</article>
</main>
</div>
@code {
[Inject] IJSRuntime JSRuntime { get; set; }
IJSObjectReference module;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
try
{
module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./js/app.js");
}
catch (Exception ex)
{
Console.Write(ex.Message);
throw;
}
}
}