HKC_Blazor/MasaBlazorApp3/Shared/SettingLayout.razor

95 lines
2.3 KiB
Plaintext

@inherits LayoutComponentBase
@* @page "/manage/setting" *@
@layout MainLayout
<div class="app-container">
<div class="sidebar">
<RadzenPanelMenu>
@foreach (var menuItem in menuItems)
{
@if (menuItem.Children.Any())
{
<RadzenPanelMenuItem Text="@menuItem.Name" Icon="@menuItem.Icon">
@foreach (var child in menuItem.Children)
{
<RadzenPanelMenuItem Text="@child.Name" Icon="@child.Icon" />
}
</RadzenPanelMenuItem>
}
else
{
<RadzenPanelMenuItem Text="@menuItem.Name" Icon="@menuItem.Icon" Path="@menuItem.Path" />
}
}
</RadzenPanelMenu>
</div>
<!-- 右侧内容区域 -->
<div class="main">
<div class="content">
@Body
</div>
</div>
</div>
<style>
.app-container {
display: flex;
height: 100vh;
}
.sidebar {
width: 250px;
background-color: #f8f9fa;
border-right: 1px solid #dee2e6;
height: 100vh;
display: flex;
flex-direction: column;
}
.sidebar-header {
padding: 1rem;
border-bottom: 1px solid #dee2e6;
}
.main {
flex: 1;
display: flex;
flex-direction: column;
height: 100vh;
overflow: auto;
}
.top-row {
height: 60px;
border-bottom: 1px solid #dee2e6;
display: flex;
align-items: center;
padding: 0 1rem;
}
.content {
flex: 1;
padding: 1rem;
overflow-y: auto;
}
</style>
@inject NavigationManager Navigation
@inject ISettingManuDao settingManuDao;
@code {
RadzenPanelMenu panelMenu;
List<SettingManu> menuItems = new();
protected override async Task OnInitializedAsync()
{
menuItems = await settingManuDao.GetMenuItemsAsync();
}
// async void jump2Page(string path)
// {
// Navigation.NavigateTo(path);
// //可以在这里添加其他逻辑,例如记录导航历史或更新状态
// Console.WriteLine($"Navigating to: {path}");
// }
}