Open jeanscircuits opened 1 year ago
I know the question is a bit old, but just in case it helps, I made it work with Nuxt3 this way:
npm install @imengyu/vue3-context-menu
// ~/plugins/vue3-context-menu.ts
import ContextMenu from '@imengyu/vue3-context-menu'
import '@imengyu/vue3-context-menu/lib/vue3-context-menu.css'
export default defineNuxtPlugin(nuxtApp => {
nuxtApp.vueApp.use(ContextMenu)
})
Implement the Component in your template
<script lang="ts" setup>
//...
const contextMenuOptions = ref({})
//...
const showMenu = (event: MouseEvent)=>{
contextMenuOptions.value = {
zIndex:100,
x: event.x,
y: event.y
}
}
menuVisible.value = true
//event.stopPropagation()
}
const itemClicked(item){
//do whatever you want when item is clicked
}
//...
</script>
Help me to use in Nuxt 3 please.