Skip to content

Commit 2e49c84

Browse files
committed
refactor: 脚本兼容
1 parent 0b48201 commit 2e49c84

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/BootstrapBlazor/Components/Layout/Layout.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<CascadingValue Value="this" IsFixed="true">
88
@if (IsAuthenticated)
99
{
10-
<section @attributes="AdditionalAttributes" class="@ClassString" style="@StyleString">
10+
<section @attributes="AdditionalAttributes" id="@Id" class="@ClassString" style="@StyleString">
1111
@if (Side == null)
1212
{
1313
if (Header != null)

src/BootstrapBlazor/Components/Tab/Tab.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
580580
/// <inheritdoc/>
581581
/// </summary>
582582
/// <returns></returns>
583-
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, nameof(DragItemCallback));
583+
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, nameof(DragItemCallback), Layout?.Id);
584584

585585
private void RemoveLocationChanged()
586586
{

src/BootstrapBlazor/Components/Tab/Tab.razor.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const disposeDragItems = items => {
171171
})
172172
}
173173

174-
export function init(id, invoke, method) {
174+
export function init(id, invoke, method, layoutId) {
175175
const el = document.getElementById(id)
176176
if (el === null) {
177177
return
@@ -180,11 +180,17 @@ export function init(id, invoke, method) {
180180
const tab = { el, invoke, method }
181181
Data.set(id, tab)
182182

183-
tab.header = el.firstChild
183+
if (layoutId) {
184+
const layout = document.getElementById(layoutId)
185+
tab.header = layout.querySelector('.layout-header .tabs > .tabs-header');
186+
}
187+
else {
188+
tab.header = el.firstChild
189+
}
190+
184191
tab.wrap = tab.header.firstChild
185192
tab.scroll = tab.wrap.querySelector('.tabs-nav-scroll')
186193
tab.tabNav = tab.scroll.firstChild
187-
188194
tab.resizeHandler = () => {
189195
resize(tab)
190196
}

0 commit comments

Comments
 (0)