File tree Expand file tree Collapse file tree
src/Blazored.SessionStorage Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 Configuring this here is temporary. Later we'll move the app config
33 into Program.cs, and it won't be necessary to specify AppAssembly.
44-->
5- <Router AppAssembly =typeof(Program).Assembly >
6- <NotFoundContent >
7- Route Not Found.
8- </NotFoundContent >
9- </Router >
5+ <Router AppAssembly =" @typeof(Program).Assembly" >
6+ <Found Context =" routeData" >
7+ <RouteView RouteData =" @routeData" DefaultLayout =" @typeof(MainLayout)" />
8+ </Found >
9+ <NotFound >
10+ <LayoutView Layout =" @typeof(MainLayout)" >
11+ <p >Sorry, there's nothing at this address.</p >
12+ </LayoutView >
13+ </NotFound >
14+ </Router >
Original file line number Diff line number Diff line change 1111 </PropertyGroup >
1212
1313 <ItemGroup >
14- <PackageReference Include =" Microsoft.AspNetCore.Blazor" Version =" 3.0.0-preview8.19405.7 " />
15- <PackageReference Include =" Microsoft.AspNetCore.Blazor.Build" Version =" 3.0.0-preview8.19405.7 " PrivateAssets =" all" />
16- <PackageReference Include =" Microsoft.AspNetCore.Blazor.DevServer" Version =" 3.0.0-preview8.19405.7 " PrivateAssets =" all" />
14+ <PackageReference Include =" Microsoft.AspNetCore.Blazor" Version =" 3.0.0-preview9.19424.4 " />
15+ <PackageReference Include =" Microsoft.AspNetCore.Blazor.Build" Version =" 3.0.0-preview9.19424.4 " PrivateAssets =" all" />
16+ <PackageReference Include =" Microsoft.AspNetCore.Blazor.DevServer" Version =" 3.0.0-preview9.19424.4 " PrivateAssets =" all" />
1717 </ItemGroup >
1818
1919 <ItemGroup >
Original file line number Diff line number Diff line change 11@using System .Net .Http
22@using Microsoft .AspNetCore .Components .Routing
3+ @using Microsoft .AspNetCore .Components .Web
34@using Microsoft .JSInterop
45@using BlazorClientSide
56@using BlazorClientSide .Shared
Original file line number Diff line number Diff line change 22 The Router component displays whichever component has a @page
33 directive matching the current URI.
44*@
5- <Router AppAssembly =" typeof(Startup).Assembly" >
6- <NotFoundContent >
7- Route Not Found.
8- </NotFoundContent >
9- </Router >
5+ <Router AppAssembly =" @typeof(Program).Assembly" >
6+ <Found Context =" routeData" >
7+ <RouteView RouteData =" @routeData" DefaultLayout =" @typeof(MainLayout)" />
8+ </Found >
9+ <NotFound >
10+ <LayoutView Layout =" @typeof(MainLayout)" >
11+ <p >Sorry, there's nothing at this address.</p >
12+ </LayoutView >
13+ </NotFound >
14+ </Router >
Original file line number Diff line number Diff line change 11@page " /"
2+ @using Microsoft .AspNetCore .Components .Web
23@inject ISessionStorageService sessionStorage
34
45<h1 >Blazored SessionStorage Sample</h1 >
4748 int ItemsInSessionStorage { get ; set ; }
4849 string Name { get ; set ; }
4950
50- protected override async Task OnAfterRenderAsync ()
51+ protected override async Task OnAfterRenderAsync (bool firstRender )
5152 {
5253 await GetNameFromSessionStorage ();
5354 await GetSessionStorageLength ();
Original file line number Diff line number Diff line change 2222 <link href =" css/site.css" rel =" stylesheet" />
2323</head >
2424<body >
25- <app >@( await Html .RenderComponentAsync <App >()) </app >
25+ <app >@( await Html .RenderComponentAsync <App >(RenderMode . Server )) </app >
2626
2727 <script src =" _framework/blazor.server.js" ></script >
2828 <script src =" _content/Blazored.SessionStorage/blazored-sessionstorage.js" ></script >
Original file line number Diff line number Diff line change 11@using System .Net .Http
22@using Microsoft .AspNetCore .Components .Forms
33@using Microsoft .AspNetCore .Components .Routing
4+ @using Microsoft .AspNetCore .Components .Web
45@using Microsoft .JSInterop
56@using BlazorServerSide .Shared
67
Original file line number Diff line number Diff line change 2020 </PropertyGroup >
2121
2222 <ItemGroup >
23- <PackageReference Include =" Microsoft.AspNetCore.Components" Version =" 3.0.0-preview8.19405.7 " />
24- <PackageReference Include =" Microsoft.AspNetCore.Components.Web" Version =" 3.0.0-preview8.19405.7 " />
23+ <PackageReference Include =" Microsoft.AspNetCore.Components" Version =" 3.0.0-preview9.19424.4 " />
24+ <PackageReference Include =" Microsoft.AspNetCore.Components.Web" Version =" 3.0.0-preview9.19424.4 " />
2525 </ItemGroup >
2626
2727</Project >
You can’t perform that action at this time.
0 commit comments