![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
vue-simple-context-menu
Advanced tools
Simple context-menu component built for Vue. Works well with both left and right clicks. Nothing too fancy, just works and is simple to use.
# npm
npm i vue-simple-context-menu
#yarn
yarn add vue-simple-context-menu
Or you can include it through the browser at the bottom of your page:
<script src="https://unpkg.com/vue-simple-context-menu"></script>
Just a simple little menu to be shown where a click happens - closes after use automatically by clicking an option or outside of the menu.
import VueSimpleContextMenu from 'vue-simple-context-menu'
Vue.component('vue-simple-context-menu', VueSimpleContextMenu)
<!-- This is a basic use case where you have an array of items that you want
to allow to be clicked. In this case, `items` is an array of objects.
Each item has a click event that ties to a function. See the demo for a full example. -->
<div class="item-wrapper">
<div v-for="item in items" @click.prevent.stop="handleClick($event, item)" class="item-wrapper__item">
{{item.name}}
</div>
</div>
<!-- Make sure you add the `ref` attribute, as that is what gives you the ability
to open the menu. -->
<vue-simple-context-menu
:options="options"
ref="vueSimpleContextMenu"
@optionClicked="optionClicked">
</vue-simple-context-menu>
<!-- The click-handler function -->
handleClick (event, item) {
this.$refs.vueSimpleContextMenu.showMenu(event, item)
}
Note - you must pass the click event-info variable to the showMenu()
function because that's how we know where to show the menu.
Note - make sure to use @click.prevent.stop
or @contextmenu.prevent.stop
for right click) when setting up the click handler.
prop | type | description |
---|---|---|
options | Array | Array of menu options to show. Component will use the name parameter as the label. |
method | parameters | description |
---|---|---|
showMenu | event (MouseEvent), item (Object) | Used to show the menu. Make sure to pass a MouseEvent and an Object. |
event | value | description |
---|---|---|
optionClicked | Object | When a menu item is clicked the component will emit an event with a value containing the clicked item and the menu option that was clicked. Register for this event to capture the selection result. |
.vue-simple-context-menu {
&--active {
}
&__item {
&:hover {
}
}
}
# install dependencies
npm install
# serve with hot reload
npm run watch
# build demo page
npm run build:example
# build
npm run build
# publish to npm
npm version patch
npm publish
Go ahead and fork the project! Submit an issue if needed. Have fun!
Influenced by Lucas Calazans's pen. Go ahead and check out his other work.
Packaged with a mixture of vue-lib-template and vue-sfc-rollup.
FAQs
Simple context-menu component built for Vue. Works well with both left and right clicks. Nothing too fancy, just works and is simple to use.
The npm package vue-simple-context-menu receives a total of 4,564 weekly downloads. As such, vue-simple-context-menu popularity was classified as popular.
We found that vue-simple-context-menu demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.