[Vuejs]-Error in v-on handler: "TypeError: Cannot call a class as a function" in vue js

5👍

It looks to me like you’re just calling SweetAlert incorrectly.

So rather than this:

toast({
  type: 'success',
  title: 'User Created in successfully'
})

it should be:

toast.fire({
  type: 'success',
  title: 'User Created in successfully'
})

Alternatively if you want to use toast as a function you could define it as:

window.toast = function (...args) {
  return toast.fire(...args);
};

Leave a comment