使用MVC和服务器端Blazor的最新发布版本,我在现有的.NET应用程序中实现了Blazor组件(感谢Chris https://chrissainty.com/using-blazor-components-in-an-existing-mvc-application/)我只能在默认页面(即https://localhost:5433)上呈现Blazor组件。Blazor组件在默认页面中工作得很好,但当我尝试使用https://localhost:5433/home/index或任何其他视图打开视图时,Blazor组件无法呈现。
我是不是漏掉了什么?
发布于 2019-12-12 00:00:44
我想通了!要回答一些问题和一个可重复的示例:
创建一个空的MVC核心应用程序,并遵循克里斯蒂安的教程,了解如何在现有的MVC https://chrissainty.com/using-blazor-components-in-an-existing-mvc-application/中实现Blazor
我没有注意到我在使用
@(await Html.RenderComponentAsync<CoursesList>(**RenderMode.Server**,
new { Courses = Model }))而不是
@(await Html.RenderComponentAsync<CoursesList(**RenderMode.ServerPrerendered**,
new { Courses = Model }))当我更改渲染模式时,页面现在可以工作了。
https://stackoverflow.com/questions/59273580
复制相似问题