30 lines
992 B
Vue
Raw Normal View History

2024-03-23 17:20:00 +08:00
<script setup lang="ts">
2024-03-23 17:21:39 +08:00
import { useNavTabStore } from '/admin/stores/modules/tabs'
import ContextMenu from './contextMenu.vue'
import { computed, ref, onMounted,onBeforeUnmount, watch } from 'vue'
const navTabStore = useNavTabStore()
const tabs = computed(() => navTabStore.getNavTabs)
2024-03-23 17:20:00 +08:00
</script>
<template>
2024-03-23 17:21:39 +08:00
<div class="h-10 bg-white dark:bg-regal-dark px-1 sm:px-3 w-full flex gap-x-2" ref="container" v-if="tabs.length > 0">
<ContextMenu>
<el-tag
class="mt-1.5 hover:cursor-pointer"
v-for="(tag, index) in tabs" :key="index"
:closable="!tag.meta.affix"
:disable-transitions="false"
:effect="tag.is_active ? 'dark' : 'plain'"
@click.prevent="navTabStore.selectTab(tag)"
@close="navTabStore.removeTab(index)"
>
{{ tag.meta.title }}
</el-tag>
</ContextMenu>
</div>
2024-03-23 17:20:00 +08:00
</template>
<style scoped>
</style>