{"id":16884505,"url":"https://github.com/timwis/vue-lil-context-menu","last_synced_at":"2025-04-11T12:24:27.187Z","repository":{"id":140607150,"uuid":"93262610","full_name":"timwis/vue-lil-context-menu","owner":"timwis","description":"A flexible context menu component for Vue","archived":false,"fork":false,"pushed_at":"2017-09-05T17:25:10.000Z","size":9,"stargazers_count":13,"open_issues_count":4,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-24T22:21:10.213Z","etag":null,"topics":["context-menu","menu","vue","vuejs"],"latest_commit_sha":null,"homepage":"","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/timwis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-03T17:10:22.000Z","updated_at":"2022-11-24T05:24:24.000Z","dependencies_parsed_at":"2023-03-27T10:58:14.817Z","dependency_job_id":null,"html_url":"https://github.com/timwis/vue-lil-context-menu","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timwis%2Fvue-lil-context-menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timwis%2Fvue-lil-context-menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timwis%2Fvue-lil-context-menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timwis%2Fvue-lil-context-menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timwis","download_url":"https://codeload.github.com/timwis/vue-lil-context-menu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401480,"owners_count":21097328,"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":["context-menu","menu","vue","vuejs"],"created_at":"2024-10-13T16:28:40.160Z","updated_at":"2025-04-11T12:24:27.164Z","avatar_url":"https://github.com/timwis.png","language":"Vue","funding_links":[],"categories":["UI组件","Components \u0026 Libraries","UI Components","UI Components [🔝](#readme)"],"sub_categories":["形成","UI Components","Form"],"readme":"# vue-lil-context-menu\n\nA flexible context menu component for Vue. Pass it any menu template you like;\nit doesn't even have to be a menu. Always disappears when you expect it\nto by using an `onblur` event.\n\n```html\n\u003cdiv @contextmenu.prevent=\"$refs.menu.open\"\u003e\n  ...\n\u003c/div\u003e\n\n\u003ccontext-menu ref=\"menu\"\u003e\n  \u003cul class=\"options\"\u003e\n    \u003cli @click=\"onClick('A')\"\u003eOption A\u003c/li\u003e\n    \u003cli @click=\"onClick('B')\"\u003eOption B\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/context-menu\u003e\n\n\u003cscript\u003e\nconst contextMenu = require('vue-lil-context-menu')\n\nmodule.exports = {\n  components: {\n    'context-menu': contextMenu\n  },\n  methods: {\n    onClick (opt) {\n      console.log('Clicked', opt)\n    }\n  }\n}\n\u003c/script\u003e\n\n\u003cstyle scoped\u003e\n.options {\n  width: 250px;\n  border: 1px black solid;\n}\n\u003c/style\u003e\n```\n\nIf you'd like to pass any context from the original `oncontextmenu`\nevent down to your menu template, you can pass it as the second\nparam of `open` and access it within a [scoped slot](https://vuejs.org/v2/guide/components.html#Scoped-Slots)\nunder the `userData` property. For example:\n\n```html\n\u003cdiv @contextmenu.prevent=\"$refs.menu.open($event, 'foo')\"\u003e\n  ...\n\u003c/div\u003e\n\n\u003ccontext-menu ref=\"menu\"\u003e\n  \u003ctemplate scope=\"child\"\u003e\n    \u003cli @click=\"onClick('A', child.userData)\"\u003eOption A\u003c/li\u003e\n    \u003cli @click=\"onClick('B', child.userData)\"\u003eOption B\u003c/li\u003e\n  \u003c/template\u003e\n\u003c/context-menu\u003e\n```\n\n## Related\n- [vue-context-menu](https://github.com/vmaimone/vue-context-menu)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimwis%2Fvue-lil-context-menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimwis%2Fvue-lil-context-menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimwis%2Fvue-lil-context-menu/lists"}