Show Blazor namespaces (#20637)
parent
70426fd6ac
commit
c8b021fd23
|
@ -80,6 +80,38 @@ If updating a Blazor WebAssembly project, skip to the [Update Blazor WebAssembly
|
|||
+<link href="BlazorSample.Client.styles.css" rel="stylesheet" />
|
||||
```
|
||||
|
||||
1. Include a new namespace in the app's `_Imports.razor` file for [component virtualization](xref:blazor/components/virtualization), <xref:Microsoft.AspNetCore.Components.Web.Virtualization?displayProperty=fullName>. The following `_Imports.razor` files show the default namespaces in apps generated from the Blazor project templates. The placeholder `{ASSEMBLY NAME}` is the app's assembly name.
|
||||
|
||||
Blazor WebAssembly (`_Imports.razor`):
|
||||
|
||||
```razor
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||
@using Microsoft.JSInterop
|
||||
@using {ASSEMBLY NAME}
|
||||
@using {ASSEMBLY NAME}.Shared
|
||||
```
|
||||
|
||||
Blazor Server (`_Imports.razor`):
|
||||
|
||||
```razor
|
||||
@using System.Net.Http
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using {ASSEMBLY NAME}
|
||||
@using {ASSEMBLY NAME}.Shared
|
||||
```
|
||||
|
||||
1. In the `MainLayout` component (`Shared/MainLayout.razor`), surround the component's HTML markup with a `<div>` element that has a `class` attribute set to `page`:
|
||||
|
||||
```razor
|
||||
|
|
Loading…
Reference in New Issue