{"id":25516922,"url":"https://github.com/microdroid/vue-context-menu","last_synced_at":"2025-12-13T14:30:14.651Z","repository":{"id":57134526,"uuid":"208169249","full_name":"MicroDroid/vue-context-menu","owner":"MicroDroid","description":"Context menus for VueJS","archived":false,"fork":false,"pushed_at":"2019-09-14T00:27:01.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T19:12:05.031Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MicroDroid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-13T00:29:18.000Z","updated_at":"2024-01-25T11:23:10.000Z","dependencies_parsed_at":"2022-09-04T16:21:54.815Z","dependency_job_id":null,"html_url":"https://github.com/MicroDroid/vue-context-menu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroDroid%2Fvue-context-menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroDroid%2Fvue-context-menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroDroid%2Fvue-context-menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicroDroid%2Fvue-context-menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MicroDroid","download_url":"https://codeload.github.com/MicroDroid/vue-context-menu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239680981,"owners_count":19679508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-19T14:52:59.144Z","updated_at":"2025-12-13T14:30:14.600Z","avatar_url":"https://github.com/MicroDroid.png","language":"Vue","readme":"vue-context-menu\n==============\n\n\u003e The plugin is VERY minimal and does NOT provide any styling or anything. This simplifies context menus implementation but that's it.\n\n## Usage\n\nThere are **three** steps for using this plugin.\n\n#### Step 1: Create context menu\n\n```vue\n\u003ctemplate\u003e\n  ...\n  \u003cContextMenu ref=\"contextMenu\"\u003e\n    interesting stuff\n  \u003c/ContextMenu\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import ContextMenu from '@overcoder/vue-context-menu';\n  \n  export default {\n    ...\n    \n    components: {\n      ...\n      ContextMenu,\n    },\n  };\n\u003c/script\u003e\n```\n\n#### Step 2: Trigger the menu\n\n```vue\n  \u003cul\u003e\n    \u003cli v-for=\"cats in cat\" :key=\"cat.id\"\n      @contextmenu.prevent=\"event =\u003e contextMenu.open(event)\"\u003e\n      {{ cat.name }}\n    \u003c/li\u003e\n  \u003c/ul\u003e\n```\n\n\u003e Test it out, context menu should work now (assuming `cats`).\n\n#### Step 3: Make it useful\n\nOk first of all you noticed the `event` is passed to `contextMenu.open` and this is to determine mouse location etc.\n\nNow this plugin supports thing called **contexts**, here's an example:\n\n```vue\n  \u003cul\u003e\n    \u003cli v-for=\"cats in cat\" :key=\"cat.id\"\n      @contextmenu.prevent=\"event =\u003e contextMenu.open(event, cat)\"\u003e\n      {{ cat.name }}\n    \u003c/li\u003e\n  \u003c/ul\u003e\n```\n\nYou can see we provided the `cat` as the second parameter to `contextMenu.open`. We gave it a context. Now you can access this context within the menu itself:\n\n```vue\n  \u003cContextMenu ref=\"contextMenu\"\u003e\n    \u003ctemplate v-slot=\"slotProps\"\u003e \u003c!-- slotsProps are props passed from child to slot in parent --\u003e\n      \u003c!-- Now, here slotProps.ctx does contain the context (cat) BUT --\u003e\n      \u003ctemplate v-if=\"slotProps.ctx\"\u003e \u003c!-- we need to add this since context is null on initial render --\u003e\n        \u003c!-- Now we can peacefully access slotProps.ctx without getting any errors --\u003e\n\n        {{ slotProps.ctx.name }}\n      \u003ctemplate\u003e\n    \u003c/template\u003e\n  \u003c/ContextMenu\u003e\n```\n\nThat's all I think.\n\n## Other things\n\n- `close()` closes the menu\n- You can also do `open()` without passing an event to open the menu at last position (defaults to 0,0)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrodroid%2Fvue-context-menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrodroid%2Fvue-context-menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrodroid%2Fvue-context-menu/lists"}