One of the components I am working on in Vue has a comment delete button.
<button class="button" style="background-color: grey;" @click="destroy">Delete</button>
Clicking the button will trigger the method "destroy".
destroy(){
swal({
title: "Delete this comment?",
text: "Are you sure? You won't be able to revert this!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes, Delete it!",
closeOnConfirm: true
},
function(){
axios.delete('/comment/' + this.comment.id + '/delete');
$(this.$el).fadeOut(300, () => {
return toastr.success('Comment deleted.');
});
});
},
After displaying the confirmation alert, if users click on the confirm button, the deleting process should proceed. However, it seems that the function is not being executed when the user clicks delete. What could be causing this issue?