|
|
@ -1,7 +1,7 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
<script setup lang="ts"> |
|
|
|
import type { TabItem } from '~/composables' |
|
|
|
import type { TabItem } from '~/composables' |
|
|
|
import { TabMetaInj, provide, useSidebar, useTabs } from '#imports' |
|
|
|
import { TabType } from '~/composables' |
|
|
|
import { TabType, useGlobal } from '~/composables' |
|
|
|
import { TabMetaInj, provide, useGlobal, useSidebar, useTabs } from '#imports' |
|
|
|
import MdiAirTableIcon from '~icons/mdi/table-large' |
|
|
|
import MdiAirTableIcon from '~icons/mdi/table-large' |
|
|
|
import MdiView from '~icons/mdi/eye-circle-outline' |
|
|
|
import MdiView from '~icons/mdi/eye-circle-outline' |
|
|
|
import MdiAccountGroup from '~icons/mdi/account-group' |
|
|
|
import MdiAccountGroup from '~icons/mdi/account-group' |
|
|
@ -24,6 +24,10 @@ const icon = (tab: TabItem) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { isOpen, toggle } = useSidebar() |
|
|
|
const { isOpen, toggle } = useSidebar() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onEdit(targetKey: number, action: 'add' | 'remove' | string) { |
|
|
|
|
|
|
|
if (action === 'remove') closeTab(targetKey) |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -41,8 +45,8 @@ const { isOpen, toggle } = useSidebar() |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<a-tabs v-model:activeKey="activeTabIndex" class="nc-root-tabs" type="editable-card" @edit="closeTab(activeTabIndex)"> |
|
|
|
<a-tabs v-model:activeKey="activeTabIndex" class="nc-root-tabs" type="editable-card" @edit="onEdit"> |
|
|
|
<a-tab-pane v-for="(tab, i) in tabs" :key="i"> |
|
|
|
<a-tab-pane v-for="(tab, i) of tabs" :key="i"> |
|
|
|
<template #tab> |
|
|
|
<template #tab> |
|
|
|
<div class="flex items-center gap-2"> |
|
|
|
<div class="flex items-center gap-2"> |
|
|
|
<component :is="icon(tab)" class="text-sm" /> |
|
|
|
<component :is="icon(tab)" class="text-sm" /> |
|
|
|