Vue ContextMenu - Access the Clicked Item

To access the clicked item, handle the itemClick event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the onItemClick property when you configure the UI component.

App.vue
  • <template>
  • <DxContextMenu ...
  • @item-click="itemClick"
  • />
  • </template>
  • <script>
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import DxContextMenu from 'devextreme-vue/context-menu';
  •  
  • export default {
  • components: {
  • DxContextMenu
  • },
  • methods: {
  • itemClick(e) {
  • const { itemData, itemElement, itemIndex } = e;
  • // ...
  • }
  • }
  • };
  • </script>
See Also