mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
500 B
23 lines
500 B
3 years ago
|
import { useState } from '#app'
|
||
3 years ago
|
|
||
2 years ago
|
export interface TabItem {
|
||
3 years ago
|
type: 'table' | 'view'
|
||
|
title: string
|
||
|
id: string
|
||
3 years ago
|
}
|
||
|
|
||
2 years ago
|
export default () => {
|
||
3 years ago
|
const tabs = useState<Array<TabItem>>('tabs', () => [])
|
||
3 years ago
|
const activeTab = useState<number>('activeTab', () => 0)
|
||
3 years ago
|
|
||
|
const addTab = (tabMeta: TabItem) => {
|
||
|
tabs.value = [...(tabs.value || []), tabMeta]
|
||
3 years ago
|
activeTab.value = tabs.value.length - 1
|
||
|
}
|
||
|
const clearTabs = () => {
|
||
|
tabs.value = []
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
return { tabs, addTab, activeTab, clearTabs }
|
||
3 years ago
|
}
|