Ank*_*shi 17 javascript jquery sweetalert sweetalert2
我正在使用javascript甜蜜警报库:
https://limonte.github.io/sweetalert2/
https://github.com/limonte/sweetalert2
我想从警告框中删除"确定"按钮,但我没有找到任何不显示此按钮的属性.
我正在使用timer属性timer:1000在一秒钟内关闭警报.所以,我认为在这件事上没有使用ok按钮.
Vip*_*ock 34
您可以使用以下属性:
showCancelButton: false, // There won't be any cancel button
showConfirmButton: false // There won't be any confirm button
Run Code Online (Sandbox Code Playgroud)
像这样
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')
}
}
)
Run Code Online (Sandbox Code Playgroud)
您需要showConfirmButton:false在配置中进行设置。
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showConfirmButton:false,
confirmButtonText: 'Yes, delete it!'
})
Run Code Online (Sandbox Code Playgroud)
这是小提琴
| 归档时间: |
|
| 查看次数: |
33440 次 |
| 最近记录: |