WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 69b4b01

Browse files
authored
feat(Layout): add ShowTabInHeader parameter (#19)
* refactor: 增加 ShowTabInHeader 配置项 * refactor: 更新 Users 页面样式 * refactor: 调整 Widget 显示
1 parent 8178ce2 commit 69b4b01

File tree

20 files changed

+117
-30
lines changed

20 files changed

+117
-30
lines changed

src/Auto-Per/BootstrapBlazorApp.Client/Pages/Users.razor

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
<PageTitle>花名册</PageTitle>
66

7+
<HeadContent>
8+
<style>
9+
.layout-main > .tabs:has( > .tabs-header) {
10+
--bb-demo-tab-header-height: 40px;
11+
}
12+
</style>
13+
</HeadContent>
14+
715
<div class="page-user">
816
<h1>花名册</h1>
917

src/Auto-Per/BootstrapBlazorApp.Client/Pages/Users.razor.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010

1111
::deep .table-users {
12-
height: calc(100% - 93px);
12+
height: calc(100% - 51px - var(--bb-demo-tab-header-height, 0px));
1313
}
1414

1515
::deep .table-cell img {

src/Auto-Per/BootstrapBlazorApp/Components/Layout/MainLayout.razor

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
TabDefaultUrl="/" UseTabSet="false" IsFixedTabHeader="IsFixedTabHeader" Menus="Menus"
66
ShowSplitebar="true" SidebarMinWidth="200" SidebarMaxWidth="350"
77
TabStyle="TabStyle.Chrome" ShowToolbar="true" ShowTabContextMenu="true"
8+
ShowTabInHeader="@ShowTabInHeader" ShowTabExtendButtons="false"
89
AdditionalAssemblies="new[] { GetType().Assembly, typeof(BootstrapBlazorApp.Client._Imports).Assembly }"
910
class="@Theme">
1011
<Header>
1112
<CollapseBar></CollapseBar>
12-
<span class="ms-3 flex-sm-fill d-none d-sm-block">Bootstrap of Blazor</span>
13-
<div class="flex-fill d-sm-none">
14-
</div>
15-
<Widget></Widget>
13+
@if (ShowTabInHeader == false)
14+
{
15+
<span class="ms-3 flex-sm-fill d-none d-sm-block">Bootstrap of Blazor</span>
16+
<div class="flex-fill d-sm-none"></div>
17+
<Widget></Widget>
18+
}
1619
<Logout ImageUrl="images/Argo-C.png" DisplayName="超级管理员" UserName="Admin">
1720
<LinkTemplate>
1821
<a href="#"><i class="fa-solid fa-suitcase"></i>个人中心</a>

src/Auto-Per/BootstrapBlazorApp/Components/Layout/MainLayout.razor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public partial class MainLayout
1717

1818
private bool ShowFooter { get; set; } = true;
1919

20+
private bool ShowTabInHeader { get; set; } = true;
21+
2022
private List<MenuItem>? Menus { get; set; }
2123

2224
/// <summary>

src/Auto/BootstrapBlazorApp.Client/Layout/MainLayout.razor

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
IsPage="true" IsFullSide="@IsFullSide" IsFixedHeader="@IsFixedHeader" IsFixedFooter="@IsFixedFooter"
66
ShowSplitebar="true" SidebarMinWidth="200" SidebarMaxWidth="350"
77
TabStyle="TabStyle.Chrome" ShowToolbar="true" ShowTabContextMenu="true"
8+
ShowTabInHeader="@ShowTabInHeader" ShowTabExtendButtons="false"
89
TabDefaultUrl="/" UseTabSet="@UseTabSet" IsFixedTabHeader="IsFixedTabHeader" AdditionalAssemblies="new[] { GetType().Assembly }"
910
Menus="@Menus" class="@Theme">
1011
<Header>
11-
<span class="ms-3 flex-sm-fill d-none d-sm-block">Bootstrap of Blazor</span>
12-
<div class="flex-fill d-sm-none">
13-
</div>
14-
<Widget></Widget>
12+
@if (ShowTabInHeader == false)
13+
{
14+
<span class="ms-3 flex-sm-fill d-none d-sm-block">Bootstrap of Blazor</span>
15+
<div class="flex-fill d-sm-none"></div>
16+
<Widget></Widget>
17+
}
1518
<Logout ImageUrl="images/Argo-C.png" DisplayName="超级管理员" UserName="Admin">
1619
<LinkTemplate>
1720
<a href="#"><i class="fa-solid fa-suitcase"></i>个人中心</a>
@@ -93,6 +96,12 @@
9396
<div class="col-6">
9497
<span class="cell-label">固定标签页</span>
9598
</div>
99+
<div class="col-6">
100+
<Switch @bind-Value="@ShowTabInHeader" OnColor="@Color.Success"></Switch>
101+
</div>
102+
<div class="col-6">
103+
<span class="cell-label">@(ShowTabInHeader ? "顶栏标签" : "正常标签")</span>
104+
</div>
96105
</div>
97106
</GroupBox>
98107
</div>

src/Auto/BootstrapBlazorApp.Client/Layout/MainLayout.razor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public partial class MainLayout
2121

2222
private bool ShowFooter { get; set; } = true;
2323

24+
private bool ShowTabInHeader { get; set; } = true;
25+
2426
private List<MenuItem>? Menus { get; set; }
2527

2628
/// <summary>

src/Auto/BootstrapBlazorApp.Client/Pages/Users.razor

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33

44
<PageTitle>花名册</PageTitle>
55

6+
<HeadContent>
7+
<style>
8+
.layout-main > .tabs:has( > .tabs-header) {
9+
--bb-demo-tab-header-height: 40px;
10+
}
11+
</style>
12+
</HeadContent>
13+
614
<div class="page-user">
715
<h1>花名册</h1>
816

src/Auto/BootstrapBlazorApp.Client/Pages/Users.razor.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010

1111
::deep .table-users {
12-
height: calc(100% - 93px);
12+
height: calc(100% - 51px - var(--bb-demo-tab-header-height, 0px));
1313
}
1414

1515
::deep .table-cell img {

src/Server/BootstrapBlazorApp.Server/Components/Layout/MainLayout.razor

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@
55
IsPage="true" IsFullSide="@IsFullSide" IsFixedHeader="@IsFixedHeader" IsFixedFooter="@IsFixedFooter"
66
ShowSplitebar="true" SidebarMinWidth="200" SidebarMaxWidth="350"
77
TabStyle="TabStyle.Chrome" ShowToolbar="true" ShowTabContextMenu="true"
8-
TabDefaultUrl="/" UseTabSet="@UseTabSet" IsFixedTabHeader="IsFixedTabHeader" AdditionalAssemblies="new[] { GetType().Assembly }"
8+
ShowTabInHeader="@ShowTabInHeader" ShowTabExtendButtons="false"
9+
TabDefaultUrl="/" UseTabSet="@UseTabSet" IsFixedTabHeader="IsFixedTabHeader"
10+
AdditionalAssemblies="new[] { GetType().Assembly }"
911
Menus="@Menus" class="@Theme">
1012
<Header>
11-
<span class="ms-3 flex-sm-fill d-none d-sm-block">Bootstrap of Blazor</span>
12-
<div class="flex-fill d-sm-none">
13-
</div>
14-
<Widget></Widget>
13+
@if (ShowTabInHeader == false)
14+
{
15+
<span class="ms-3 flex-sm-fill d-none d-sm-block">Bootstrap of Blazor</span>
16+
<div class="flex-fill d-sm-none"></div>
17+
<Widget></Widget>
18+
}
1519
<Logout ImageUrl="images/Argo-C.png" DisplayName="超级管理员" UserName="Admin">
1620
<LinkTemplate>
1721
<a href="#"><i class="fa-solid fa-suitcase"></i>个人中心</a>
1822
<a href="#"><i class="fa-solid fa-cog"></i>设置</a>
1923
<a href="#"><i class="fa-solid fa-bell"></i>通知<span class="badge badge-pill badge-success"></span></a>
20-
<LogoutLink />
24+
<LogoutLink></LogoutLink>
2125
</LinkTemplate>
2226
</Logout>
2327
<div class="layout-drawer" @onclick="@(e => IsOpen = !IsOpen)"><i class="fa fa-gears"></i></div>
@@ -40,9 +44,6 @@
4044
<a class="page-layout-demo-footer-link" href="https://pro.blazor.zone/" target="_blank">Bootstrap Admin</a>
4145
</div>
4246
</Footer>
43-
<NotFound>
44-
<p>Sorry, there's nothing at this address.</p>
45-
</NotFound>
4647
</Layout>
4748

4849
<Drawer Placement="Placement.Right" @bind-IsOpen="@IsOpen" IsBackdrop="true">
@@ -96,6 +97,12 @@
9697
<div class="col-6">
9798
<span class="cell-label">固定标签页</span>
9899
</div>
100+
<div class="col-6">
101+
<Switch @bind-Value="@ShowTabInHeader" OnColor="@Color.Success"></Switch>
102+
</div>
103+
<div class="col-6">
104+
<span class="cell-label">@(ShowTabInHeader ? "顶栏标签" : "正常标签")</span>
105+
</div>
99106
</div>
100107
</GroupBox>
101108
</div>

src/Server/BootstrapBlazorApp.Server/Components/Layout/MainLayout.razor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public sealed partial class MainLayout
2424

2525
private bool ShowFooter { get; set; } = true;
2626

27+
private bool ShowTabInHeader { get; set; } = true;
28+
2729
private List<MenuItem>? Menus { get; set; }
2830

2931
/// <summary>

0 commit comments

Comments
 (0)