search

Home  >  Q&A  >  body text

The rewritten title is: SweetAlert2: "onBeforeOpen" parameters are unknown

I'm using Laravel 5.8 and Sweetalert v2 and I'm trying to trigger this alert on Blade with it:

Swal.fire({
    title: '<h4 style="color: #0c5460;">Updating user status</h4>',
    html: '<h5 style="color: #0c5460">Wait...</h5>',
    width: 400,
    padding: '1em',
    background: '#fff url(/images/cream_pixels.png)',
    timer: 1000,
    onBeforeOpen: () => {
        Swal.showLoading()
    },
});

It pops up correctly but doesn't show the loader and shows me this error on the console:

SweetAlert2: Unknown parameter "onBeforeOpen"

So what’s the problem here?

P粉709644700P粉709644700400 days ago910

reply all(1)I'll reply

  • P粉676821490

    P粉6768214902023-11-11 00:30:03

    Using didOpen: Runs asynchronously after the popup is shown on the screen. Provide popup DOM element as parameter

    Swal.fire({
                    didOpen: () => {
                      Swal.showLoading();
                    }
                  })

    reply
    0
  • Cancelreply