2
0
Fork 0
mirror of https://github.com/koel/koel synced 2024-12-29 14:03:06 +00:00
koel/resources/assets/js/composables/useContextMenu.ts
2022-12-02 17:17:37 +01:00

22 lines
478 B
TypeScript

import { reactive, ref } from 'vue'
import ContextMenuBase from '@/components/ui/ContextMenuBase.vue'
export const useContextMenu = () => {
const base = ref<InstanceType<typeof ContextMenuBase>>()
const open = async (top: number, left: number) => await base.value?.open(top, left)
const close = () => base.value?.close()
const trigger = (func: Closure) => {
close()
func()
}
return {
ContextMenuBase,
base,
open,
close,
trigger
}
}