How to programmatically open ContextMenu #2245
Unanswered
nathan-de-pachtere
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
Is there a way to programmatically open a ContextMenu?
Using
v-model:opendoesn’t seem to work, and dispatching an event on the trigger element doesn’t either. #701It would be great if the v-model could also take the mouse position into account when the trigger element is located elsewhere. (outside of ContextMenuTrigger)
Why do I need this?
I want to use a single ContextMenu component for a list of elements, without having to loop and render one menu per item — to keep the DOM clean and lightweight.
Each list item should be able to trigger the same ContextMenu by emitting an event and passing its data, so the menu content can adapt accordingly.
This approach works perfectly with the Dialog component using
v-model, but with ContextMenu, changing thev-modelvalue doesn’t seem to open it.Beta Was this translation helpful? Give feedback.
All reactions