koel/resources/assets/js/composables/useContextMenu.ts
2022-04-19 21:26:06 +02:00

16 lines
429 B
TypeScript

import { defineAsyncComponent, ref } from 'vue'
export const useContextMenu = () => {
const BaseContextMenu = defineAsyncComponent(() => import('@/components/ui/context-menu.vue'))
const base = ref<InstanceType<typeof BaseContextMenu>>()
const open = (top: number, left: number) => base.value?.open(top, left)
const close = () => base.value?.close()
return {
base,
BaseContextMenu,
open,
close
}
}