[英]Run js code in blazor without having to call a function
我找不到任何可以讓我在 blazor 中運行 js 代碼而不必從 js 文件中調用 function 的東西,我想知道是否有可能,因為在我的 Z547594DC43E7B7 中編寫一些 js 會容易得多零件。
像這樣的東西:
@inject IJSRuntime JSRuntime
@code {
protected override void OnInitialized()
{
JSRuntime.InvokeVoidAsync(
{
// Write JS in here, like this:
console.log("i possible hope this is");
});
StateHasChanged();
}
}
像上面的例子有可能嗎?
you have to call a function but can work around as eval is a function takes JS code used it to inject JS from library projects https://blog.ppedv.de/post/Razor-Classlibrary-JavaScript-einbinden
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.