CyberNika / v-contextmenu

🖱 ContextMenu based on Vue 3 & Vue 2
https://cybernika.github.io/v-contextmenu/
MIT License
918 stars 112 forks source link

How to access the element under the contextmenu? #111

Open crystalfp opened 2 years ago

crystalfp commented 2 years ago

I have the contextmenu over a list of <div> (see below). How could I access the div over which I right clicked to open the contextmenu? Here is an example:

  <v-contextmenu ref="contextmenu">
    <v-contextmenu-item @click.prevent="showContent">Menu Item</v-contextmenu-item>
  </v-contextmenu>

  <div v-contextmenu:contextmenu>
    <div id="aaa">Item aaa</div>
    <div id="bbb">Item bbb</div>
    <div id="ccc">Item ccc</div>
  </div>

in the method showContent how I could access the id of the div I right-clicked on? Thanks for your help! mario