1)使用Ant 样式。结果弹窗提示怎么都出不来。
只要在App.razor 加最后一句即可
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
@*弹窗生效*@
<AntContainer />
2)我创建的是Blazor 项目。需要使用到mvc 只需要注入一下。即可正常使用
在Program.cs (我是Net 6? 。<6的在 ConfigureServices里)
//兼容mvc
app.MapControllers();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
//app.MapBlazorHub(); //注入后blazor样式会失效。暂时没弄明白