로크소르 - RoxxorXx
로크소르 - RoxxorXx
CC#
Created by 로크소르 - RoxxorXx on 10/12/2023 in #help
❔ Blazor Server .net7 js injection
Hey, i'm currently leaning blazor, i've seen that js can be isolated as css file but i have to do
@code
{
private IJSObjectReference module;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
Console.WriteLine("index");
module = await JS.InvokeAsync<IJSObjectReference>("import", "./Pages/Index.razor.js");
}
}
@code
{
private IJSObjectReference module;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
Console.WriteLine("index");
module = await JS.InvokeAsync<IJSObjectReference>("import", "./Pages/Index.razor.js");
}
}
so that mean for every component that i want to use i need to redo that. I see the way to use an @inherit and doing a generic class to do that but i want to figure out if maybe there is a better way to "inject" js when ther eis a component.razor.js file available
2 replies
CC#
Created by 로크소르 - RoxxorXx on 12/6/2022 in #help
❔ Getter on code dom
Hey, I am looking to have something like get => uwu["x"]; on the last line. Is there a way to do thaht ?
var x = new CodeMemberField(typeof(Dictionary<string, Dictionary<string, string>>), "uwu");
x.InitExpression = new CodeObjectCreateExpression(typeof(Dictionary<string, Dictionary<string, string>>));
class1.Members.Add(x);

var f = new CodeMemberProperty();
f.Name = "fr";
f.GetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(x.Name)));
var x = new CodeMemberField(typeof(Dictionary<string, Dictionary<string, string>>), "uwu");
x.InitExpression = new CodeObjectCreateExpression(typeof(Dictionary<string, Dictionary<string, string>>));
class1.Members.Add(x);

var f = new CodeMemberProperty();
f.Name = "fr";
f.GetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(x.Name)));
3 replies