Reputation: 21
How to trigger close event in Beufy? I tried the code below but I cannot see my console. I am suppose to do something before "closing".
this.$modal.open({
parent: this,
component: myComponent,
hasModalCard: true,
canCancel: true,
events: {
close: (value) => {
console.log('im here!', value)
}
}
})
Upvotes: 0
Views: 337
Reputation: 21
So I figure out how to trigger an event before closing my modal on submit.
First, I created a custom event inside my modal in the "Parent" component:
this.$modal.open({
parent: this,
component: myComponent,
hasModalCard: true,
canCancel: true,
events: {
afterSubmit: (value) => {
// Do something here. In my case, I am setting something in a field in my parent from Store.
}
}
})
Second, I did an $emit inside my "Child" component in the function where I am calling on "Submit" button.
submitForm() {
this.$emit('afterSubmit', value)
}
Upvotes: 1