So, in my Vue instance, I have a currentTask
model, which is null by default.
new Vue({
el: '...',
data: {
currentTask: null
}
});
When I click on a 'task-item', which has v-on="click: openTask"
directive, i want to launch the modal with the currentTask:
methods: {
openTask: function(e) {
this.currentTask = this.clickedTask;
$('#task-modal').modal('show');
e.preventDefault();
}
}
This is working just fine, although I don't know if there is a more "magical" way to two-way bind the whole modal + visibility to the currentTask.
Now, what I need, if there is no better way to go about this, is to somehow listen for the modal close event, which normally we would do in jQuery with $('#myModal').on('hidden.bs.modal', function() {});
inside of Vue and set this.currentTask = null;
.
Thank you.