Can anyone help me with importing sweetalert2 correctly to use Swal in this file only? I tried using
<script src = "https://cdn.jsdelivr.net/npm/sweetalert2@9">
but it's not working as expected. What could be the issue?
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a8deddcd85dcc9cac4cddb859ae89a8698869a9b">[email protected]</a>/dist/vue-tables.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<script>
Vue.config.devtools = true;
Vue.use(VueTables);
Vue.use(SweetAlert);
const Event = VueTables.Event;
const Swal = SweetAlert;
Vue.component("modal", {
template: "#modal-template"
});
new Vue({
el: "#crm-app",
data() {
return {
dataTable: [],
states: [],
selectedState: '',
managers: [],
isModalVisible: false,
}
},
methods: {
deleteItem: function(){
Swal.fire({
title: 'Error!',
text: 'Do you want to continue',
icon: 'error',
confirmButtonText: 'Cool'
});
},
......
Encountering an error in the console:
sweetalert2@9:1 Uncaught TypeError: Cannot call a class as a function