Skip to content

Commit c784d21

Browse files
authored
doc(ComponentLayout): support lazy load (#1779)
* refactor: 重命名组件 * doc: 优化组件多面板逻辑懒加载 * chore: bump version 7.9.0
1 parent 2ac52c7 commit c784d21

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

src/BootstrapBlazor.Shared/Components/Pre.razor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ protected override void OnParametersSet()
8383
CopiedText ??= Localizer[nameof(CopiedText)];
8484
}
8585

86-
8786
/// <summary>
8887
/// <inheritdoc/>
8988
/// </summary>

src/BootstrapBlazor.Shared/Shared/ComponentLayout.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
<hr />
3030

3131
<div class="tabs-coms">
32-
<Tab IsBorderCard="true">
32+
<Tab IsBorderCard="true" IsLazyLoadTabItem="true" @ref="Tab">
3333
<TabItem Text="Example" Icon="fa-solid fa-desktop">
3434
@Body
3535
</TabItem>
3636
<TabItem Text="Razor" Icon="fa-brands fa-html5">
37-
<Pre CodeFile="@RazorFileName" class="code-razor"></Pre>
37+
<Pre @key="@RazorFileName" CodeFile="@RazorFileName" class="code-razor"></Pre>
3838
</TabItem>
3939
<TabItem Text="C#" Icon="fa-regular fa-file-code">
40-
<Pre CodeFile="@CSharpFileName" class="code-cs"></Pre>
40+
<Pre @key="@CSharpFileName" CodeFile="@CSharpFileName" class="code-cs"></Pre>
4141
</TabItem>
4242
<TabItem Text="@Video" Icon="fa-regular fa-file-video">
4343
<Video @key="@VideoFileName" Name="@VideoFileName"></Video>

src/BootstrapBlazor.Shared/Shared/ComponentLayout.razor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public partial class ComponentLayout : IAsyncDisposable
4343
[NotNull]
4444
private IJSRuntime? JSRuntime { get; set; }
4545

46+
[NotNull]
47+
private Tab? Tab { get; set; }
48+
4649
/// <summary>
4750
/// Instance of <see cref="JSModule"/>
4851
/// </summary>
@@ -97,6 +100,8 @@ protected override void OnParametersSet()
97100
RazorFileName = $"{comName}.razor";
98101
CSharpFileName = $"{comName}.razor.cs";
99102
VideoFileName = comName;
103+
104+
Tab?.ActiveTab(0);
100105
}
101106

102107
/// <summary>

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>7.8.11</Version>
4+
<Version>7.9.0</Version>
55
</PropertyGroup>
66

77
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

src/BootstrapBlazor/Components/LazyLoading/LazyLoading.cs renamed to src/BootstrapBlazor/Components/LazyLoad/LazyLoad.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace BootstrapBlazor.Components;
99
/// <summary>
1010
/// 懒加载组件
1111
/// </summary>
12-
public partial class LazyLoading : ComponentBase
12+
public partial class LazyLoad : ComponentBase
1313
{
1414
/// <summary>
1515
/// 获得/设置 子组件

test/UnitTest/Components/LazyLoadingTest.cs renamed to test/UnitTest/Components/LazyLoadTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace UnitTest.Components;
66

7-
public class LazyLoadingTest : TestBase
7+
public class LazyLoadTest : TestBase
88
{
99
[Fact]
1010
public void LazyLoading_Ok()
1111
{
12-
var cut = Context.RenderComponent<LazyLoading>(pb =>
12+
var cut = Context.RenderComponent<LazyLoad>(pb =>
1313
{
1414
pb.Add(a => a.ChildContent, "<div>content</div>");
1515
});
@@ -19,7 +19,7 @@ public void LazyLoading_Ok()
1919
[Fact]
2020
public void OnLoadCallbackAsync_Ok()
2121
{
22-
var cut = Context.RenderComponent<LazyLoading>(pb =>
22+
var cut = Context.RenderComponent<LazyLoad>(pb =>
2323
{
2424
pb.Add(a => a.OnLoadCallbackAsync, () => Task.FromResult(false));
2525
pb.Add(a => a.ChildContent, "<div>content</div>");
@@ -31,7 +31,7 @@ public void OnLoadCallbackAsync_Ok()
3131
public void OnFirstLoadCallbackAsync_Ok()
3232
{
3333
var load = false;
34-
var cut = Context.RenderComponent<LazyLoading>(pb =>
34+
var cut = Context.RenderComponent<LazyLoad>(pb =>
3535
{
3636
pb.Add(a => a.OnLoadCallbackAsync, () => Task.FromResult(true));
3737
pb.Add(a => a.OnFirstLoadCallbackAsync, () =>

0 commit comments

Comments
 (0)