You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A future release of .NET might provide a framework-based loading indicator. In the meantime, you can add a custom loading indicator to a Blazor Web App.
614
611
615
612
#### Per-component Interactive WebAssembly rendering with prerendering
@@ -625,6 +622,37 @@ To load CSS styles for the indicator, add the styles to `<head>` content with th
If you didn't already have a `Layout` folder in the `.Client` project, add the namespace for the `Layout` folder to the `_Imports.razor` file. In the following example, the project's namespace is `BlazorSample.Client`:
684
+
685
+
```razor
686
+
@using BlazorSample.Client.Layout
687
+
```
688
+
651
689
In a component that adopts Interactive WebAssembly rendering, wrap the component's Razor markup with the `ContentLoading` component. The following example demonstrates the approach with the `Counter` component of an app created from the Blazor Web App project template.
652
690
653
691
`Pages/Counter.razor`:
@@ -676,10 +714,6 @@ In a component that adopts Interactive WebAssembly rendering, wrap the component
676
714
}
677
715
```
678
716
679
-
:::moniker-end
680
-
681
-
:::moniker range=">= aspnetcore-9.0"
682
-
683
717
#### Global Interactive WebAssembly rendering with prerendering
684
718
685
719
*This scenario applies to global Interactive WebAssembly rendering with prerendering (`@rendermode="InteractiveWebAssembly"` on the `HeadOutlet` and `Routes` components in the `App` component).*
@@ -693,6 +727,10 @@ To load CSS styles for the indicator, add the styles to `<head>` content with th
If you didn't already have a `Layout` folder in the `.Client` project, add the namespace for the `Layout` folder to the `_Imports.razor` file. In the following example, the project's namespace is `BlazorSample.Client`:
789
+
790
+
```razor
791
+
@using BlazorSample.Client.Layout
792
+
```
793
+
719
794
In the `MainLayout` component (`Layout/MainLayout.razor`) of the `.Client` project, wrap the <xref:Microsoft.AspNetCore.Components.LayoutComponentBase.Body%2A> property (`@Body`) with the `ContentLoading` component:
720
795
721
796
In `Layout/MainLayout.razor`:
@@ -726,10 +801,6 @@ In `Layout/MainLayout.razor`:
726
801
+ </ContentLoading>
727
802
```
728
803
729
-
:::moniker-end
730
-
731
-
:::moniker range=">= aspnetcore-8.0"
732
-
733
804
#### Global Interactive WebAssembly rendering without prerendering
734
805
735
806
*This scenario applies to global Interactive WebAssembly rendering without prerendering (`@rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)"` on the `HeadOutlet` and `Routes` components in the `App` component).*
0 commit comments