I want to achieve something that I have seen multiple times on various sites. I'll provide a scenario so it will be easier to understand what I'm trying to achieve. Let's say I have a button which executes file downloading. Sometimes this button might have additional event to open up a modal with some information, after clicking "continue" in this modal, the download event should be fired as if it would without this interception. There might also be a cancel button in that modal which would cancel the download action. How might I achieve this? I already had this implemented using jquery but now I'm reworking my project to use vue and the way I achieved it with jquery was very dirty, hack-ish and unstable.
Asked
Active
Viewed 399 times
0
-
2This becomes flaky with events alone. There should be a promise of a modal, so it could be easily chained, e.g. `const result = await openModal()`. The result may differ between success and cancel. – Estus Flask Aug 24 '21 at 07:30
-
@EstusFlask Haven't thought about using promises, that might set me on the right track. Thanks – Matrix Aug 24 '21 at 07:55