From 4f43a466c8b3a1ab153d3a108fdb88547c035bc0 Mon Sep 17 00:00:00 2001 From: "Vigo.zhou" Date: Wed, 30 Apr 2025 15:48:05 +0800 Subject: [PATCH] fix: silly bug --- src/hooks/useTabScroll.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/useTabScroll.ts b/src/hooks/useTabScroll.ts index bc259ba..5ce9592 100644 --- a/src/hooks/useTabScroll.ts +++ b/src/hooks/useTabScroll.ts @@ -16,7 +16,7 @@ export function useTabScroll(currentTabPath: Ref) { const scrollToCurrentTab = () => { nextTick(() => { const currentTabElement = document.querySelector(`[data-tab-path="${currentTabPath.value}"]`) as HTMLElement - const tabBarScrollWrapper = document.querySelector('.n-scrollbar-container') + const tabBarScrollWrapper = document.querySelector('.tab-bar-scroller-wrapper .n-scrollbar-container') const tabBarScrollContent = document.querySelector('.tab-bar-scroller-content') if (currentTabElement && tabBarScrollContent && tabBarScrollWrapper) { @@ -26,6 +26,9 @@ export function useTabScroll(currentTabPath: Ref) { const tabWidth = currentTabElement.getBoundingClientRect().width const containerPR = Number.parseFloat(window.getComputedStyle(tabBarScrollContent).paddingRight) + console.log(tabLeft, tabBarLeft, wrapperWidth, tabWidth, containerPR,tabLeft + tabWidth + safeArea.value + containerPR > wrapperWidth + tabBarLeft,tabLeft - safeArea.value < tabBarLeft); + + if (tabLeft + tabWidth + safeArea.value + containerPR > wrapperWidth + tabBarLeft) { handleTabSwitch(tabLeft + tabWidth + containerPR - wrapperWidth + safeArea.value) } else if (tabLeft - safeArea.value < tabBarLeft) {