Skip to content

Commit 438d0f7

Browse files
committed
refactor: 合并脚本
1 parent 3e9f839 commit 438d0f7

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/BootstrapBlazor/Components/Table/Table.razor.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@ export function init(id, invoke, options) {
2121
reset(id)
2222
}
2323

24-
export function scrollTop(id) {
25-
const table = Data.get(id)
26-
if (table === null) {
27-
return;
28-
}
29-
30-
const body = table.tables.length === 2 ? table.tables[1] : table.tables[0];
31-
body.parentElement.scrollTo({
32-
top: 0,
33-
left: 0,
34-
behavior: "smooth",
35-
});
36-
}
37-
3824
export function reloadColumnWidth(tableName) {
3925
const key = `bb-table-column-width-${tableName}`
4026
return localStorage.getItem(key);
@@ -213,12 +199,16 @@ export function scroll(id, align, options = { behavior: 'smooth' }) {
213199
}
214200
}
215201

216-
export function scrollTo(id, x = 0, y = 0, options = { behavior: 'smooth' }) {
202+
export function scrollTo(id) {
217203
const element = document.getElementById(id);
218204
if (element) {
219205
const scroll = element.querySelector('.scroll');
220206
if (scroll) {
221-
scroll.scrollTo(x, y, options);
207+
scroll.scrollTo({
208+
top: 0,
209+
left: 0,
210+
behavior: "smooth",
211+
});
222212
}
223213
}
224214
}

0 commit comments

Comments
 (0)