mirror of
https://github.com/chansee97/nova-admin.git
synced 2025-05-21 00:09:16 +08:00
fix: silly bug
This commit is contained in:
parent
292471ce2f
commit
4f43a466c8
@ -16,7 +16,7 @@ export function useTabScroll(currentTabPath: Ref<string>) {
|
|||||||
const scrollToCurrentTab = () => {
|
const scrollToCurrentTab = () => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const currentTabElement = document.querySelector(`[data-tab-path="${currentTabPath.value}"]`) as HTMLElement
|
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')
|
const tabBarScrollContent = document.querySelector('.tab-bar-scroller-content')
|
||||||
|
|
||||||
if (currentTabElement && tabBarScrollContent && tabBarScrollWrapper) {
|
if (currentTabElement && tabBarScrollContent && tabBarScrollWrapper) {
|
||||||
@ -26,6 +26,9 @@ export function useTabScroll(currentTabPath: Ref<string>) {
|
|||||||
const tabWidth = currentTabElement.getBoundingClientRect().width
|
const tabWidth = currentTabElement.getBoundingClientRect().width
|
||||||
const containerPR = Number.parseFloat(window.getComputedStyle(tabBarScrollContent).paddingRight)
|
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) {
|
if (tabLeft + tabWidth + safeArea.value + containerPR > wrapperWidth + tabBarLeft) {
|
||||||
handleTabSwitch(tabLeft + tabWidth + containerPR - wrapperWidth + safeArea.value)
|
handleTabSwitch(tabLeft + tabWidth + containerPR - wrapperWidth + safeArea.value)
|
||||||
} else if (tabLeft - safeArea.value < tabBarLeft) {
|
} else if (tabLeft - safeArea.value < tabBarLeft) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user