HKC_Blazor/MasaBlazorApp3/Shared/SettingLayout.razor

99 lines
2.5 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;
@inject Toolbelt.Blazor.I18nText.I18nText I18nText;
@code {
private I18nText.local myText = new I18nText.local();
RadzenPanelMenu panelMenu;
List<SettingManu> menuItems = new();
protected override async Task OnInitializedAsync()
{
myText = await I18nText.GetTextTableAsync<I18nText.local>(this);
string culture = I18nText.GetCurrentLanguageAsync().Result == "en-US" ? "en" : "zh-CN"; ;
menuItems = await settingManuDao.GetMenuItemsAsync(culture);
}
// async void jump2Page(string path)
// {
// Navigation.NavigateTo(path);
// //可以在这里添加其他逻辑,例如记录导航历史或更新状态
// Console.WriteLine($"Navigating to: {path}");
// }
}