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
2 years ago
|
import { useState } from '#app'
|
||
2 years ago
|
|
||
2 years ago
|
export interface TabItem {
|
||
2 years ago
|
type: 'table' | 'view'
|
||
|
title: string
|
||
|
id: string
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
export default () => {
|
||
2 years ago
|
const tabs = useState<Array<TabItem>>('tabs', () => [])
|
||
2 years ago
|
const activeTab = useState<number>('activeTab', () => 0)
|
||
2 years ago
|
|
||
|
const addTab = (tabMeta: TabItem) => {
|
||
|
tabs.value = [...(tabs.value || []), tabMeta]
|
||
2 years ago
|
activeTab.value = tabs.value.length - 1
|
||
|
}
|
||
|
const clearTabs = () => {
|
||
|
tabs.value = []
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
return { tabs, addTab, activeTab, clearTabs }
|
||
2 years ago
|
}
|