Skip to content

Commit 05ff413

Browse files
committed
Exported Blazor components as web components
1 parent c329330 commit 05ff413

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Blazor/BlazorComponents.csproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.10" />
11-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.10" PrivateAssets="all" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.CustomElements" Version="7.0.13" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.13" />
12+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.13" PrivateAssets="all" />
1213
</ItemGroup>
1314

1415
</Project>

Blazor/Program.cs

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BlazorComponents;
2+
using BlazorComponents.Components;
23
using Microsoft.AspNetCore.Components.Web;
34
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
45

@@ -8,4 +9,8 @@
89

910
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
1011

12+
// Register our components as a custom elements
13+
builder.RootComponents.RegisterCustomElement<Counter>("blazor-counter");
14+
builder.RootComponents.RegisterCustomElement<HeroEditor>("blazor-heroeditor");
15+
1116
await builder.Build().RunAsync();

0 commit comments

Comments
 (0)