Hi!
Is it possible to set data or props inside a modal from outside, without giving it as props in the declaration?
Like, if I define a modal like this;
but I want to show it with different parameters, depending on where the 'show' is called, like for example like this;
@click="$modal.show('error-modal', 'data'));"
Is it possible to achieve this in some way?
Would greatly appreciate any help :)
Like a verification modal where you accept or deny deletion of a user, so you need to know what user is in question inside the modal :)
Hey,
Try this:
@click="$modal.show('error-modal', { foo: 'bar' });
In modal component:
<template>
<modal name="error-modal" @before-open="beforeOpen">
...
</modal>
</template>
methods: {
beforeOpen (event) {
console.log(event.params) // <- your data is here
}
}
For more a workign example look in demo -> ConditionalModal.vue
Thank you so much mate!
This was exactly what I was looking for 馃憤
No probs 馃槃 Thanks for using the plugin!
Most helpful comment
Hey,
Try this:
In modal component:
For more a workign example look in demo -> ConditionalModal.vue