首页 > 解决方案 > 启动另一个时不要隐藏 SweetAlert2

问题描述

我正在使用 SweetAlert2。我想在另一个警报后面显示一个警报,以便当用户单击“确定”按钮时,另一个警报会显示在它后面。

标签: javascriptsweetalertsweetalert2

解决方案


配置文档上的许多演示/示例:https
: //sweetalert2.github.io/#configuration 将其添加为 Promise,然后在当前 SweetAlert 之后启动。

Swal.fire("1").then(x =>
  Swal.fire("2").then( x =>
    x.value && Swal.fire("3")))
    // check x.value, only fire "3" if button clicked
.then( x =>
  Swal.queue(["5","6","7"]))
  // you can also use queue to queue up alerts
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>


推荐阅读