I've created a directive for that. It is very easy to use. If the delete button was clicked it's gonna ask confirmation then submit a delete form with csrf token.
Here is the directive:
import swal from 'sweetalert';
module.exports = {
isLiteral: true,
bind: function () {
var _this = this;
this.el.addEventListener('click', function (e) {
e.preventDefault();
swal({
title: "Are you sure?",
text: "You're deleting a data!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, Go",
cancelButtonText: "Cancel",
closeOnConfirm: false
}, function () {
$('<form method="POST" action="'+ _this.expression +'"><input type="hidden" name="_method" value="DELETE" /><input type="hidden" name="_token" value="'+ App.csrfToken +'" /></form>')
.submit();
});
}.bind(this));
}
}
----------
Vue.directive('safe-delete', require('path-to-directive'));
And use it wherever you want like this
<a v-safe-delete="{{ url()->route('route-to-destroy') }}" class="btn btn-danger">Delete</a>