【发布时间】:2020-10-21 21:49:50
【问题描述】:
我正在使用this 答案中的示例在 swal 上显示不止 2 个按钮。 当用户单击拒绝按钮时,我想更改 swal 的 html 中的某些内容而不关闭它。现在,当单击拒绝按钮时,swal 将关闭。 我在哪里以及如何指定 swal 不应该关闭?
【问题讨论】:
标签: sweetalert2
我正在使用this 答案中的示例在 swal 上显示不止 2 个按钮。 当用户单击拒绝按钮时,我想更改 swal 的 html 中的某些内容而不关闭它。现在,当单击拒绝按钮时,swal 将关闭。 我在哪里以及如何指定 swal 不应该关闭?
【问题讨论】:
标签: sweetalert2
我刚刚添加了preDeny 参数,它允许通过返回保持模式打开
false:
Swal.fire({
title: 'The "deny" button will not close me',
showDenyButton: true,
preDeny: () => {
return false
}
})
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
阅读更多关于preDeny:https://sweetalert2.github.io/#pre-deny
【讨论】: