Skip to content

Commit 6602036

Browse files
committed
refactor: 更改获得 Target 参数方法
1 parent 52d30ad commit 6602036

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

src/BootstrapBlazor/Components/GoTop/GoTop.razor

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 7 deletions
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

Lines changed: 1 addition & 0 deletions
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()

0 commit comments

Comments
 (0)