简体   繁体   English

是否可以在根索引页面中添加 blazor 组件?

[英]Is it possible to add a blazor component in the root index page?

I am referring to this index page (wwwroot)我指的是这个索引页(wwwroot)

I am working with blazor wasm and I don't like the "Loading..." you get when you first pull up the application home page.我正在使用 blazor wasm 并且我不喜欢您第一次打开应用程序主页时看到的“正在加载...”。 So I am working in the index page to replace that with a spinner.所以我正在索引页面中使用微调器替换它。 This is simple enough if you just use html but I prefer to create a spinner blazor component which I would then reuse in the rest of the app.如果您只使用 html,这很简单,但我更喜欢创建一个 spinner blazor 组件,然后我将在应用程序的其余部分中重用它。 Is this possible?这可能吗?

ie IE

<app><MyLoadingComponent/></app>

I would understand if this is not possible due to the fact that at this point blazor has not loaded (as far as I know).如果由于此时 blazor 尚未加载(据我所知)而无法实现,我会理解。

No you cannot load a razor component in index.HTML.不,您不能在 index.HTML 中加载剃刀组件。 But you could change the boring loading.... message with a nice page.但是你可以用一个漂亮的页面来改变无聊的加载...消息。

But the best option would be to use server side pre-rendering.但最好的选择是使用服务器端预渲染。 This will render your component on startup while the rest of the app loads.这将在应用程序的其余部分加载时在启动时呈现您的组件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM