如何禁用Blazor服务器端预渲染?

编程入门 行业动态 更新时间:2024-10-28 22:24:37
本文介绍了如何禁用Blazor服务器端预渲染?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

要在asp核心预览版3上禁用服务器端预渲染,您只需注释 @(await Html.RenderComponentAsync< MyApp>()).

To disable server side pre-render on asp core preview 3, you just needed to comment @(await Html.RenderComponentAsync<MyApp>()).

从asp核心预览版4开始,当您注释此行时,该页面将不呈现,并且在主要组件 @page"/" 上,标记< app>保持空白.

Since asp 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找到了一个解决方案来源: github/aspnet/AspNetCore/issues/9584#issuecomment-485257261

Finally found a solution by cores-system in github Source: github/aspnet/AspNetCore/issues/9584#issuecomment-485257261

app.UseEndpoints(endpoints => { endpoints.MapBlazorHub().AddComponent<App>(selector: "app"); endpoints.MapFallbackToFile("index.html"); // or - endpoints.MapFallbackToPage("/_Host"); });

希望这行得通...

更多推荐

如何禁用Blazor服务器端预渲染?

本文发布于:2023-11-14 16:52:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588008.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器端   Blazor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!