Vue Promise Dialogs
A tiny & modern library that allows you to work with dialogs as with asynchronous functions.
Why?
Because many dialogs work exactly as promises.
They are opened (called) and then closed with some result (resolved) or canceled (rejected).
Install
Or for a CDN version, you can use it on unpkg.com
Usage
Main requirements:
- You should mount exactly one
PromiseDialogsWrapper
somewhere in your application root. - The dialog component should accept
params
props. - The dialog component should emit
resolve
orreject
events when the user makes a decision.
Vue Class Component Example
If you're using Vue Class Component to define your dialog components, you can extend them from BasePromiseDialog
.
This will allow you to avoid defining type arguments in createPromiseDialog
.
BasePromiseDialog
already defines params
prop and methods resolve
/reject
, so you don't have to.