|
|
|
@ -2,39 +2,39 @@
|
|
|
|
|
import UserManagement from './auth/UserManagement.vue' |
|
|
|
|
import ApiTokenManagement from './auth/ApiTokenManagement.vue' |
|
|
|
|
|
|
|
|
|
interface TabGroup { |
|
|
|
|
[key: string]: { |
|
|
|
|
title: string |
|
|
|
|
body: any |
|
|
|
|
} |
|
|
|
|
interface Tab { |
|
|
|
|
title: string |
|
|
|
|
body: any |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const tabsInfo: TabGroup = { |
|
|
|
|
usersManagement: { |
|
|
|
|
const tabsInfo: Tab[] = [ |
|
|
|
|
{ |
|
|
|
|
title: 'Users Management', |
|
|
|
|
body: () => UserManagement, |
|
|
|
|
}, |
|
|
|
|
apiTokenManagement: { |
|
|
|
|
{ |
|
|
|
|
title: 'API Token Management', |
|
|
|
|
body: () => ApiTokenManagement, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
const firstKeyOfObject = (obj: object) => Object.keys(obj)[0] |
|
|
|
|
// const firstKeyOfObject = (obj: object) => Object.keys(obj)[0] |
|
|
|
|
|
|
|
|
|
const selectedTabKeys = $ref<string[]>([firstKeyOfObject(tabsInfo)]) |
|
|
|
|
const selectedTab = $computed(() => tabsInfo[selectedTabKeys[0]]) |
|
|
|
|
const selectedTabKey = $ref(0) |
|
|
|
|
const selectedTab = $computed(() => tabsInfo[selectedTabKey]) |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<div class="mt-2"> |
|
|
|
|
<a-menu v-model:selectedKeys="selectedTabKeys" :open-keys="[]" mode="horizontal"> |
|
|
|
|
<a-menu-item v-for="(tab, key) of tabsInfo" :key="key" class="select-none"> |
|
|
|
|
<div class="text-xs pb-2.5"> |
|
|
|
|
{{ tab.title }} |
|
|
|
|
</div> |
|
|
|
|
</a-menu-item> |
|
|
|
|
</a-menu> |
|
|
|
|
<div> |
|
|
|
|
<a-tabs v-model:active-key="selectedTabKey" class="" :open-keys="[]" mode="horizontal"> |
|
|
|
|
<a-tabs-tab-pane v-for="(tab, key) of tabsInfo" :key="key" class="select-none"> |
|
|
|
|
<template #tab> |
|
|
|
|
<span class="mx-3"> |
|
|
|
|
{{ tab.title }} |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
</a-tabs-tab-pane> |
|
|
|
|
</a-tabs> |
|
|
|
|
|
|
|
|
|
<div class="mx-4 py-6 mt-2"> |
|
|
|
|
<component :is="selectedTab.body()" /> |
|
|
|
|