import { ContextMenuTemp } from "@/common/components/contextMenu/interface";
import { ref } from "vue";

// 处理右键打开与关闭逻辑
export function handleContextMenu() {
    // 右键数据
    const contextMenu = ref<ContextMenuTemp>({
        position: { clientX: 0, clientY: 0 },
        show: false,
    })
    // 打开右键
    function openContext(value: ContextMenuTemp) {
        contextMenu.value = value
    }
    // 关闭右键
    function closeContext() {
        contextMenu.value = {
            position: { clientX: 0, clientY: 0 },
            show: false,
        }
    }
    return { contextMenu, openContext, closeContext }
}