I want to close vuejs modal from child component inside this modal. Case:
<modal name="some-modal">
<some-component></some-component>
</modal>
Inside SomeComponent i want to close some-modal. Is it good approach ? Can it be done better way ? Please adivse, Regards
You need to emit an event from the child component using this.$emit('exit', true)
.
Then listen for that event in the parent component (Modal).
<modal name="some-modal">
<some-component @exit="closeModal"></some-component>
</modal>
Then write the logic to closeModal function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With