我是一個在甜蜜戒備中的菜鳥。 是否有可能創建一個甜蜜的提示提示,其中有確認按鈕,取消和計時器。帶有確認和取消按鈕的計時器
邏輯是如果警報沒有確認,定時器自動執行與取消相同的功能。我試過並卡住了。即使警報已確認,定時器仍在計數並且調用取消功能。
sweetAlert({
title: 'Stay in fullscreen',
text: "You will be logged out in 10 seconds or if you leave the fullscreen!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#ff0000',
confirmButtonText: 'Go fullscreen!',
cancelButtonText: 'Leave this page!',
confirmButtonClass: 'btn btn-success',
cancelButtonClass: 'btn btn-warning',
closeOnConfirm: 'true',
timer:'10000',
buttonsStyling: false
},function(isConfirm) {
if (isConfirm) {
return launchIntoFullscreen(document.documentElement) // timer still still counting
} else {
return Redirect()
}
}).then(function() {
swal(
window.alert('teest')
)
}, function (dismiss) {
// dismiss can be 'cancel', 'overlay',
// 'close', and 'timer'
if (dismiss === 'timer') {
return Redirect()
}
})
表明你已經嘗試和OP – guradio