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