koel/resources/assets/js/composables/useContextMenu.ts

17 lines
429 B
TypeScript
Raw Normal View History

2022-04-15 17:00:08 +00:00
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
}
}