mirror of
https://github.com/koel/koel
synced 2024-12-29 22:13:06 +00:00
17 lines
429 B
TypeScript
17 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
|
||
|
}
|
||
|
}
|