tv-modal
tv-modal copied to clipboard
Hook into model destroy
Thank you for this cool package!
I'm trying to show/hide a loading state when toggling a model.
confirmDelete() {
this.loading = true
this.$modal.show({
type: 'danger',
title: 'Are you sure?',
body:
'Are you sure you want to remove this item?',
primary: {
label: 'Delete',
theme: 'red',
action: () => this.deleteItem(),
},
secondary: {
label: 'Cancel',
theme: 'white',
action: () => (this.loading = false),
},
})
},
Currently, it turns off the loading on Cancel (secondary) button. I want to be able to do the same when the model is closed, which happens on an outside click.
Also, it would be nice to have the models close on Esc
key down too.
The PR here https://github.com/acidjazz/tv-modal/pull/5 once merged will allow for this in 2 different ways. You can provide backdropDismiss:false to prevent closing the modal without tapping an action or by the destroyed parameter which is called if present after the modal is closed.
@centogram Can you please separate the destruction options into a separate PR than the inputs? I can approve that much easier