删除“确定"甜蜜警报对话框中的按钮 [英] Remove "OK" button from sweet alert dialog
本文介绍了删除“确定"甜蜜警报对话框中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 javascript
解决方案
您可以使用以下属性:
showCancelButton: false,//不会有取消按钮showConfirmButton: false//不会有任何确认按钮
喜欢这个
swal({title: '自动关闭警报!',text: '我将在 2 秒后关闭.',计时器:2000,显示取消按钮:假,显示确认按钮:假}).然后(功能 () {},//处理承诺拒绝功能(解除){if (dismiss === '定时器') {//console.log('我被计时器关闭了')}})
I am using javascript sweetalert2 library.
I want to remove the OK button from the alert box but I did not find any property for not to display this button.
I am using the timer property timer:1000
for closing the alert in one second.
So, I don't think there is a use of the ok button in this matter.
解决方案
You can use these properties:
showCancelButton: false, // There won't be any cancel button
showConfirmButton: false // There won't be any confirm button
Like This
swal({
title: 'Auto close alert!',
text: 'I will close in 2 seconds.',
timer: 2000,
showCancelButton: false,
showConfirmButton: false
}).then(
function () {},
// handling the promise rejection
function (dismiss) {
if (dismiss === 'timer') {
//console.log('I was closed by the timer')
}
}
)
这篇关于删除“确定"甜蜜警报对话框中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文