I hope to have two different pages in the web app that use different style libraries, such as one using Bootstrap 3 and the other using Bootstrap 5
In .NET 7, two different implementations of _host.cshtml
can be used. However, in the .NET 8 web app, there is no longer a host.cshtml
file and it has been replaced by an app.razor
file.
May I ask how to fulfill my above requirements?
I hope to have two different pages in the web app that use different style libraries, such as one using Bootstrap 3 and the other using Bootstrap 5
In .NET 7, two different implementations of _host.cshtml
can be used. However, in the .NET 8 web app, there is no longer a host.cshtml
file and it has been replaced by an app.razor
file.
May I ask how to fulfill my above requirements?
Share Improve this question edited Nov 20, 2024 at 17:12 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Nov 20, 2024 at 15:34 King LeeKing Lee 331 silver badge2 bronze badges1 Answer
Reset to default 0You may try
@if (somecondition)
{
<link rel="stylesheet" href="......."]
}
else
{
<link rel="stylesheet" href="......."]
}
.....
@code{
// condition based on httpcontext
[CascadingParameter]
HttpContext? context{ get; set; }
}
in app.razor
when you navigate to pages in diffent styles,you need a full-page reload
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742348675a4427065.html
评论列表(0条)