Skip to content

Commit 0517990

Browse files
committed
refactor: 更新滚动脚本
1 parent 4a79674 commit 0517990

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/BootstrapBlazor/Components/TreeView/TreeView.razor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export function init(id, options) {
3030

3131
export function scroll(id, options) {
3232
const el = document.getElementById(id);
33-
const item = el.querySelector(".active .tree-node");
33+
const item = el.querySelector(".tree-content.active");
3434
if (item) {
35-
item.scrollIntoView(options ?? { behavior: 'smooth', block: 'start', inline: 'nearest' });
35+
item.parentElement.scrollTo(0, item.offsetTop, options || { behavior: 'smooth' });
3636
}
3737
}
3838

0 commit comments

Comments
 (0)