简体   繁体   中英

Use SweetAlert or SweetAlert2

Can anyone advise on which sweetalert library I should use and why?

I'm writing up a node.js web-app and upon doing some research on which fancy alert libraries I can use, I came across two of them that look the same: SweetAlert and SweetAlert2 .

You should use SweetAlert2 as it's updated regularly .

From the creator of SweetAlert2 :

The SweetAlert repo seems to be unmaintained. There's a bunch of Pull Requests without any replies, the last merged pull request was on Nov 9, 2014.

I created SweetAlert2 with HTML support in modal and some other options for customization modal window - width, padding, Esc button behavior, etc.

TLDR: The original SweetAlert hasn't been updated since Apr 29 2019 , and has ignored many recent pull requests . The creator of the new SweetAlert2 stated they wanted to add some new features so that's why they created SweetAlerts2.

SweetAlert2 is simply a cleaner version. The functions are much easier to use and the documentation provides much more usability, when compared to it's first version.

As noted in the documentation, triggering the Swal in version 2 uses Swal.fire instead of Swal

Swal.fire(
  'Good job!',
  'You clicked the button!',
  'success'
)

Otherwise, there are many other customised ways to style each alert: https://sweetalert2.github.io/

Upon going through the sweetalert upgrade logs, it is recommended to use sweetalert2 because of its easy to use, flexible, awesome new changes.

You can have a read from this link: sweetalert upgrade logs

Go ahead and use SweetAlert2 .

It comes with alot of functionalities and is regularly updated.

It looks like the initial SweetAlert library has not been updated for some time now. Their NPM package shows that it was last published 3 years ago.

Also check out this answer for more info: answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM