parent
4b39a2da63
commit
361037cdbd
|
@ -1,5 +1,5 @@
|
||||||
<CascadingAuthenticationState>
|
<CascadingAuthenticationState>
|
||||||
<Router AppAssembly="@typeof(Program).Assembly" AdditionalAssemblies="new[] { typeof(MainLayout).Assembly }" PreferExactMatches="@true">
|
<Router AppAssembly="@typeof(MainLayout).Assembly" PreferExactMatches="@true">
|
||||||
<Found Context="routeData">
|
<Found Context="routeData">
|
||||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
||||||
<NotAuthorized>
|
<NotAuthorized>
|
|
@ -5,7 +5,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BootstrapBlazor" Version="5.0.30" />
|
<PackageReference Include="BootstrapBlazor" Version="5.0.31-beta03" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="5.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="5.0.6" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@page "/Home/Index"
|
@page "/"
|
||||||
|
@page "/Home/Index"
|
||||||
|
|
||||||
<h1>Hello, world!</h1>
|
<h1>Hello, world!</h1>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using BootstrapBlazor.Components;
|
using BootstrapBlazor.Components;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Components.Authorization;
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
using Microsoft.AspNetCore.Components.Routing;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
@ -30,6 +29,8 @@ namespace Bootstrap.Client.Blazor.Shared.Shared
|
||||||
|
|
||||||
private bool ShowFooter { get; set; } = true;
|
private bool ShowFooter { get; set; } = true;
|
||||||
|
|
||||||
|
private bool IsAuthenticated { get; set; }
|
||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
private List<MenuItem>? Menus { get; set; }
|
private List<MenuItem>? Menus { get; set; }
|
||||||
|
|
||||||
|
@ -82,7 +83,6 @@ namespace Bootstrap.Client.Blazor.Shared.Shared
|
||||||
{
|
{
|
||||||
UserName = state.User.Identity.Name;
|
UserName = state.User.Identity.Name;
|
||||||
DisplayName = UserHelper.RetrieveUserByUserName(UserName)?.DisplayName;
|
DisplayName = UserHelper.RetrieveUserByUserName(UserName)?.DisplayName;
|
||||||
}
|
|
||||||
|
|
||||||
// 模拟异步线程切换,正式代码中删除此行代码
|
// 模拟异步线程切换,正式代码中删除此行代码
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
@ -92,8 +92,11 @@ namespace Bootstrap.Client.Blazor.Shared.Shared
|
||||||
{
|
{
|
||||||
[""] = "Index"
|
[""] = "Index"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 获取登录用户菜单
|
||||||
Menus = GetMenus();
|
Menus = GetMenus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<MenuItem> GetMenus()
|
private List<MenuItem> GetMenus()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
@using BootstrapBlazor.Components
|
@using Bootstrap.Client.Blazor.Shared.Shared
|
||||||
|
@using BootstrapBlazor.Components
|
||||||
|
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Microsoft.AspNetCore.Components.Authorization
|
||||||
@using Microsoft.AspNetCore.Components.Forms
|
@using Microsoft.AspNetCore.Components.Forms
|
||||||
@using Microsoft.AspNetCore.Components.Routing
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@page "/"
|
@page "/"
|
||||||
|
@using Bootstrap.Client.Blazor.Shared
|
||||||
@namespace Bootstrap.Client.Blazor.Pages
|
@namespace Bootstrap.Client.Blazor.Pages
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
@{
|
@{
|
||||||
|
|
Loading…
Reference in New Issue