如何禁用Blazor服务器端预渲染? [英] How to disable Blazor server side pre-render?
问题描述
要在asp.net核心预览版3上禁用服务器端预渲染,您只需注释 @(await Html.RenderComponentAsync< MyApp>())
.
To disable server side pre-render on asp.net core preview 3, you just needed to comment @(await Html.RenderComponentAsync<MyApp>())
.
从asp.net核心预览版4开始,当您注释此行时,该页面将不呈现,并且在主要组件 @page"/"
上,标记< app>
保持空白.
Since asp.net core preview 4, when you comment this line, the page doesn't render and on the main component @page "/"
, the tag <app>
remains blank.
那么,我们如何禁用服务器端预渲染?
So, how can we disable server side pre-render ?
推荐答案
最后在github上由cores-system找到了一个解决方案来源: https://github.com/aspnet/AspNetCore/issues/9584#issuecomment-485257261
Finally found a solution by cores-system in github Source: https://github.com/aspnet/AspNetCore/issues/9584#issuecomment-485257261
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub().AddComponent<App>(selector: "app");
endpoints.MapFallbackToFile("index.html"); // or - endpoints.MapFallbackToPage("/_Host");
});
希望这行得通...
这篇关于如何禁用Blazor服务器端预渲染?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!