본문 바로가기
개발/Script

sweet alert2

by 똘또히 2020. 4. 8.

swal({

                title: "생산 & 재가공을 진행 합니다",

                text: "생산 단계를 선택를 해주세요",

                type: "info",

                showCancelButton: true,

                showCloseButton: true,

                confirmButtonClass: "btn-danger",

                confirmButtonText: "ok!!",

                cancelButtonClass: "btn-pink",

                cancelButtonColor: "#ef0000",

                cancelButtonText: "cancle!!",

                closeOnConfirm: false

            }).then((result) => {

                if (result.value) { // TRUE

                    Swal.fire(

                       'title',

                        'text',

                        'success'

                     );

                } else if (result.dismiss === Swal.DismissReason.cancel)  { // FALSE

                          swal({

                              title: "",

                              text: "",

                              html: select,

                              showCancelButton: true,

                              closeOnConfirm: false,

                              inputPlaceholder: "Write something"

                            }, function (inputValue) {

                              if (inputValue === false) return false;

                              if (inputValue === "") {

                                swal.showInputError("You need to write something!");

                                return false

                              }

                              swal("Nice!", "You wrote: " + inputValue, "success");

                            });

                        }

                    });

                };

            });


SWEET ALERT2 간략사용법 예제 입니다.