This commit is contained in:
syuilo 2023-02-20 17:28:09 +09:00
parent b055f516c0
commit b5fa8767da

View file

@ -1,23 +1,33 @@
<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"
</div> :class="[$style.tabHighlight, { [$style.animate]: defaultStore.reactiveState.animation.value }]"
></div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -206,8 +216,8 @@ onUnmounted(() => {
align-items: center; align-items: center;
} }
.tabIcon+.tabTitle { .tabIcon + .tabTitle {
padding-left: 8px; padding-left: 4px;
} }
.tabTitle { .tabTitle {