mirror of
https://github.com/koel/koel
synced 2024-12-20 09:33:23 +00:00
12 lines
321 B
TypeScript
12 lines
321 B
TypeScript
|
import { requireInjection } from '@/utils'
|
||
|
import { ModalContextKey } from '@/symbols'
|
||
|
import { Ref } from 'vue'
|
||
|
|
||
|
export const useModal = () => {
|
||
|
const [modalContext] = requireInjection<[Ref<Record<string, any>>]>(ModalContextKey)
|
||
|
|
||
|
return {
|
||
|
getFromContext: <T> (key: string) => modalContext.value[key] as T
|
||
|
}
|
||
|
}
|