fix: silly bug

This commit is contained in:
Vigo.zhou 2025-04-30 15:48:05 +08:00
parent 292471ce2f
commit 4f43a466c8

View File

@ -16,7 +16,7 @@ export function useTabScroll(currentTabPath: Ref<string>) {
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<string>) {
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) {