在不关闭 sweetalert 的情况下从 sweetalert 中发射 sweetalert toast

Fire sweetalert toast from a sweetalert without closing it

我有一种项目管理系统,我使用 sweetalert 弹出窗口作为每个项目的设置菜单,我想在设置更改时触发吐司,但这会导致菜单关闭.有没有办法在不使用另一个库的情况下完成这项工作?

这是我尝试 运行 用于 sweetalert 菜单的代码

var id = 65352;
Swal.fire({
      title: 'settings for project '+id,
      html:
        "<p>some setting</p>"+
        "<input class='toggle' id='setting' data-docid='"+id+"' type='checkbox' checked>",
        showCancelButton: true,
        showConfirmButton: false,
        cancelButtonText:  'close',
      onBeforeOpen: () => {
        const setting = $("#setting[data-docid="+id+"]");

        $(setting).on("change",function(){
            console.log($(this).attr("checked"));
            if($(this).attr("checked") == "checked"){
                $checked = 1;
            }else{
                $checked = 0;
            }
            $.parameters = {
                id: id,
                checked: $checked,
                type: "accept"
            }
            //using an api to communicate between client and server
            result = "TRUE"
            if(result.indexOf("TRUE") > -1){
                const Toast = Swal.mixin({ //when firing the toast, the first window closes automatically
                  toast: true,
                  position: 'top-end',
                  showConfirmButton: false,
                  timer: 3000
                });

                Toast.fire({
                  type: 'success',
                  title: 'changed the thingy successfully'
                })
            }else{
                const Toast = Swal.mixin({ //when firing the toast, the first window closes automatically
                  toast: true,
                  position: 'top-end',
                  showConfirmButton: false,
                  timer: 3000
                });

                Toast.fire({
                  type: 'error',
                  title: 'cant change the thingy'
                })
            }
        });

      }
    })
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8.11.5/dist/sweetalert2.all.min.js"></script>

不幸的是,reading this thread这似乎是不可能的,因为吐司在某种程度上是一种模式...

但是 last comment 指出可以修改 Swal2 的代码 ;)