This commit is contained in:
syuilo 2023-02-20 17:28:09 +09:00
parent b055f516c0
commit b5fa8767da
1 changed files with 29 additions and 19 deletions

View File

@ -1,22 +1,32 @@
<template> <template>
<div ref="el" :class="$style.tabs" @wheel="onTabWheel"> <div ref="el" :class="$style.tabs" @wheel="onTabWheel">
<div :class="$style.tabsInner"> <div :class="$style.tabsInner">
<button v-for="t in tabs" :ref="(el) => tabRefs[t.key] = (el as HTMLElement)" v-tooltip.noDelay="t.title" <button
v-for="t in tabs" :ref="(el) => tabRefs[t.key] = (el as HTMLElement)" v-tooltip.noDelay="t.title"
class="_button" :class="[$style.tab, { [$style.active]: t.key != null && t.key === props.tab, [$style.animate]: defaultStore.reactiveState.animation.value }]" class="_button" :class="[$style.tab, { [$style.active]: t.key != null && t.key === props.tab, [$style.animate]: defaultStore.reactiveState.animation.value }]"
@mousedown="(ev) => onTabMousedown(t, ev)" @click="(ev) => onTabClick(t, ev)"> @mousedown="(ev) => onTabMousedown(t, ev)" @click="(ev) => onTabClick(t, ev)"
>
<div :class="$style.tabInner"> <div :class="$style.tabInner">
<i v-if="t.icon" :class="[$style.tabIcon, t.icon]"></i> <i v-if="t.icon" :class="[$style.tabIcon, t.icon]"></i>
<div v-if="!t.iconOnly || (!defaultStore.reactiveState.animation.value && t.key === tab)" <div
:class="$style.tabTitle">{{ t.title }}</div> v-if="!t.iconOnly || (!defaultStore.reactiveState.animation.value && t.key === tab)"
<Transition v-else mode="in-out" @enter="enter" @after-enter="afterEnter" @leave="leave" :class="$style.tabTitle"
@after-leave="afterLeave"> >
{{ t.title }}
</div>
<Transition
v-else mode="in-out" @enter="enter" @after-enter="afterEnter" @leave="leave"
@after-leave="afterLeave"
>
<div v-show="t.key === tab" :class="[$style.tabTitle, $style.animate]">{{ t.title }}</div> <div v-show="t.key === tab" :class="[$style.tabTitle, $style.animate]">{{ t.title }}</div>
</Transition> </Transition>
</div> </div>
</button> </button>
</div> </div>
<div ref="tabHighlightEl" <div
:class="[$style.tabHighlight, { [$style.animate]: defaultStore.reactiveState.animation.value }]"></div> ref="tabHighlightEl"
:class="[$style.tabHighlight, { [$style.animate]: defaultStore.reactiveState.animation.value }]"
></div>
</div> </div>
</template> </template>
@ -207,7 +217,7 @@ onUnmounted(() => {
} }
.tabIcon + .tabTitle { .tabIcon + .tabTitle {
padding-left: 8px; padding-left: 4px;
} }
.tabTitle { .tabTitle {