Custom emit functions for Dialog Plugin with custom components
See original GitHub issueI appreciate this is potentially a fairly niche case, but I found myself editing Quasar (global-dialog.js) to obtain some desired functionality for a project recently.
I use custom components with the dialog plugin all the time, and I found myself needing to pass an event back to the parent component, without triggering ok
or cancel
, so I added a function definition for onCustom() under API. This works perfectly for my use case, as I simply emit custom
from my dialog component, and that passes the information back to the parent component and triggers the associated onCustom
callback function. However, it strikes me as it could be useful for users to be able to define their own custom functions on specific emitted events.
My suggested feature request is a function prop when creating the dialog component for custom dialogs, allowing users to define their own callback functions (which can include payload), and the emitted event they would be associated with.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top GitHub Comments
The name
onOk
is unfortunate. In factonCancel
is the function to be called on cancel (is the .catch) andonOk
is the one to be called when an action should be performed (is the .then) - you can pass payload when you emit, and branch your code based on the payload.Ok maybe an example for this for the documentation?? I’m not so confident to do by myself but i can try to create a simple example if needed