File size: 371 Bytes
4d70170 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { computed } from 'vue'
import { useRoute } from 'vue-router'
export function useTabs() {
const route = useRoute()
const currentTab = computed<string>(() => {
let fromMeta = route.meta.tab
if (typeof fromMeta === 'function') {
fromMeta = fromMeta(route)
}
return (fromMeta || route.name) as string
})
return {
currentTab,
}
}
|