mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
15 lines
332 B
TypeScript
15 lines
332 B
TypeScript
import type { Ref } from 'vue'
|
|
import { computed } from 'vue'
|
|
|
|
export function usePerTabState<K extends string, V>(
|
|
selectedTab: Ref<K>,
|
|
stateByTab: Ref<Record<K, V>>
|
|
) {
|
|
return computed({
|
|
get: () => stateByTab.value[selectedTab.value],
|
|
set: (value) => {
|
|
stateByTab.value[selectedTab.value] = value
|
|
}
|
|
})
|
|
}
|