fix(components): 修复多页签按钮风格的tab滚动问题
This commit is contained in:
parent
20aa39f14e
commit
c429cd0293
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="theme.multiTabStyle.mode === 'chrome'" ref="chromeTabRef" class="flex items-end h-full">
|
<div v-if="theme.multiTabStyle.mode === 'chrome'" ref="tabRef" class="flex items-end h-full">
|
||||||
<chrome-tab
|
<chrome-tab
|
||||||
v-for="(item, index) in app.multiTab.routes"
|
v-for="(item, index) in app.multiTab.routes"
|
||||||
:key="item.path"
|
:key="item.path"
|
||||||
@ -15,7 +15,7 @@
|
|||||||
{{ item.meta?.title }}
|
{{ item.meta?.title }}
|
||||||
</chrome-tab>
|
</chrome-tab>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="theme.multiTabStyle.mode === 'button'" class="flex-y-center h-full">
|
<div v-if="theme.multiTabStyle.mode === 'button'" ref="tabRef" class="flex-y-center h-full">
|
||||||
<button-tab
|
<button-tab
|
||||||
v-for="item in app.multiTab.routes"
|
v-for="item in app.multiTab.routes"
|
||||||
:key="item.path"
|
:key="item.path"
|
||||||
@ -70,12 +70,12 @@ function setDropdownConfig(x: number, y: number, currentPath: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前激活的tab的clientX
|
// 获取当前激活的tab的clientX
|
||||||
const chromeTabRef = ref<HTMLElement | null>(null);
|
const tabRef = ref<HTMLElement | null>(null);
|
||||||
async function getActiveChromeTabClientX() {
|
async function getActiveChromeTabClientX() {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
const index = app.activeMultiTabIndex;
|
const index = app.activeMultiTabIndex;
|
||||||
if (chromeTabRef.value) {
|
if (tabRef.value) {
|
||||||
const activeTabElement = chromeTabRef.value.children[index];
|
const activeTabElement = tabRef.value.children[index];
|
||||||
const { x, width } = activeTabElement.getBoundingClientRect();
|
const { x, width } = activeTabElement.getBoundingClientRect();
|
||||||
const clientX = x + width;
|
const clientX = x + width;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user