Skip to content

Commit 36aa43d

Browse files
ArgoZhangyuchen7701卢骥
authored
feat(GotoTop): support IsFixedTabHeader layout component (#4883)
* refactor: 更改获得 Target 参数方法 * feat: GotoTop 支持 Layout 固定标签页 * chore: bump version 9.1.6-beta02 --------- Co-authored-by: yuchen7701 <844356115@qq.com> Co-authored-by: 卢骥 <1429614920@qq.com>
1 parent e332b14 commit 36aa43d

File tree

6 files changed

+6
-16
lines changed

6 files changed

+6
-16
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.1.6-beta01</Version>
4+
<Version>9.1.6-beta02</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/GoTop/GoTop.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
@inherits BootstrapModuleComponentBase
33
@attribute [BootstrapModuleAutoLoader]
44

5-
<a @attributes="AdditionalAttributes" id="@Id" href="#" class="layout-gotop" data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="@TooltipText">
5+
<a @attributes="AdditionalAttributes" id="@Id" href="#" class="layout-gotop" data-bb-target="@Target" data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="@TooltipText">
66
<i class="@Icon"></i>
77
</a>

src/BootstrapBlazor/Components/GoTop/GoTop.razor.cs

-7
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,4 @@ protected override void OnParametersSet()
4949
TooltipText ??= Localizer[nameof(TooltipText)];
5050
Icon ??= IconTheme.GetIconByKey(ComponentIcons.GoTopIcon);
5151
}
52-
53-
/// <summary>
54-
/// <inheritdoc/>
55-
/// </summary>
56-
/// <returns></returns>
57-
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Target);
58-
5952
}

src/BootstrapBlazor/Components/GoTop/GoTop.razor.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function init(id, target) {
2121
EventHandler.on(el, 'click', e => {
2222
e.preventDefault();
2323

24+
const target = el.getAttribute('data-bb-target');
2425
const element = (target && document.querySelector(target)) || getScrollElement(el)
2526
element.scrollTop = 0
2627
go.tip.hide()

src/BootstrapBlazor/Components/Layout/Layout.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
@Footer
136136
@if (ShowGotoTop)
137137
{
138-
<GoTop />
138+
<GoTop Target="@GetTargetString()" />
139139
}
140140
</footer>;
141141
}

src/BootstrapBlazor/Components/Layout/Layout.razor.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ public partial class Layout : IHandlerException
327327

328328
private bool _init { get; set; }
329329

330-
//private bool _isInteractive = true;
331-
332330
/// <summary>
333331
/// <inheritdoc/>
334332
/// </summary>
@@ -343,10 +341,6 @@ protected override void OnInitialized()
343341
}
344342

345343
ErrorLogger?.Register(this);
346-
347-
#if NET9_0_OR_GREATER
348-
//_isInteractive = RendererInfo.IsInteractive;
349-
#endif
350344
}
351345

352346
/// <summary>
@@ -505,6 +499,8 @@ public virtual Task HandlerException(Exception ex, RenderFragment<Exception> err
505499
return Task.CompletedTask;
506500
}
507501

502+
private string? GetTargetString() => IsFixedTabHeader ? ".tabs-body" : null;
503+
508504
/// <summary>
509505
/// <inheritdoc/>
510506
/// </summary>

0 commit comments

Comments
 (0)