Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MicroDroid/vue-context-menu
Context menus for VueJS
https://github.com/MicroDroid/vue-context-menu
Last synced: about 1 month ago
JSON representation
Context menus for VueJS
- Host: GitHub
- URL: https://github.com/MicroDroid/vue-context-menu
- Owner: MicroDroid
- License: mit
- Created: 2019-09-13T00:29:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2019-09-14T00:27:01.000Z (over 4 years ago)
- Last Synced: 2024-01-07T13:05:32.087Z (5 months ago)
- Language: Vue
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
- awesome-vue - @overcoder/vue-context-menu - Minimal context menus (Components & Libraries / UI Components)
README
vue-context-menu
==============> The plugin is VERY minimal and does NOT provide any styling or anything. This simplifies context menus implementation but that's it.
## Usage
There are **three** steps for using this plugin.
#### Step 1: Create context menu
```vue
...
interesting stuff
import ContextMenu from '@overcoder/vue-context-menu';
export default {
...
components: {
...
ContextMenu,
},
};```
#### Step 2: Trigger the menu
```vue
- contextMenu.open(event)">
{{ cat.name }}
```
> Test it out, context menu should work now (assuming `cats`).
#### Step 3: Make it useful
Ok first of all you noticed the `event` is passed to `contextMenu.open` and this is to determine mouse location etc.
Now this plugin supports thing called **contexts**, here's an example:
```vue
- contextMenu.open(event, cat)">
{{ cat.name }}
```
You 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:
```vue
{{ slotProps.ctx.name }}
```
That's all I think.
## Other things
- `close()` closes the menu
- You can also do `open()` without passing an event to open the menu at last position (defaults to 0,0)