-1

I'm using Laravel 12 and Livewire 3, and now i'm trying to use sweetalert2 in component file. These are what I already do :

  1. install sweetalert2 : npm install sweetalert2
  2. in resources\js\app.js : import Swal from "sweetalert2"; window.Swal = Swal;
  3. in blade file : `@script window.addEventListener('swal-alert',function(e){ Swal.fire(e.detail); }); @endscript`
  4. in component file when wire:click in the button executed : $this->dispatch('swal-alert', [ 'type' => 'success', 'title' => 'Success!', 'text' => 'Operation completed successfully.' ]);

But sweetalert2 does not show up. In the blade file, I also using : <button wire:loading class="btn btn-info"> Loading... </button> this button-info is show up, but sweetalert2 does not show up, is this conflict ?

Please help.. Thank you...

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.