20260819101952

This commit is contained in:
oneao committed 2026-08-19 10:19:56 +08:00
1 parent e91fd1d8de
commit 1ffc8e1ac9
14 files changed
+258 -886

No files matched your search

@@ -151,11 +151,18 @@ function scrollTabs(direction) {
function revealActiveTab(behavior = 'smooth') {
const track = trackRef.value
if (!track) return
if (!track || !track.isConnected) return
const activeElement = Array.from(track.querySelectorAll('[data-tab-key]')).find(
(element) => element.dataset.tabKey === activeKey.value,
)
activeElement?.scrollIntoView({ behavior, block: 'nearest', inline: 'center' })
// 元素未挂载(路由过渡/布局重建时可能短暂脱离 DOM,parentNode 为 null)则跳过,
// 避免 scrollIntoView 抛出未捕获异常向上冒泡成 Promise 拒绝。
if (!activeElement || !activeElement.isConnected) return
try {
activeElement.scrollIntoView({ behavior, block: 'nearest', inline: 'center' })
} catch {
/* 元素正处于卸载/过渡中,忽略 */
}
}
function handleWheel(e) {