2017-02-23 16 views
6

kullanıyorum javascript tatlı uyarı kütüphanesi:"Tamam" Kaldır düğmesi

https://limonte.github.io/sweetalert2/

https://github.com/limonte/sweetalert2

ben uyarı kutusundan Tamam düğmesini kaldırmak istediğiniz ama bulamadık Bu düğmeyi göstermemek için herhangi bir özellik.

Bir saniyede uyarının kapatılması için zamanlayıcı özelliğini timer:1000 kullanıyorum. Yani, bu konuda iyi bir düğme olduğunu sanmıyorum.

enter image description here

+0

seti 'showConfirmButton: Yapılandırmanızda FALSE. [Dokümantasyona Link] (https://limonte.github.io/sweetalert2/#allow-enter-key) – haxxxton

cevap

13

Bu özellikleri kullanabilirsiniz: Eğer konfigürasyonda showConfirmButton:false ayarlamanız gerekir Bu

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') 
    } 
    } 
) 
+1

Uygulamam ile çalıştı: angular2 + sweetalert2, zamanımı kurtardı! :) – amey

3

gibi

showCancelButton: false, // There won't be any cancel button 
showConfirmButton: false // There won't be any confirm button 

.

A.getButtonTypes().clear(); 
ButtonType OpenStorage=new ButtonType("Open Storage"); 
A.getButtonTypes().addAll(OpenStorage,ButtonType.CANCEL,ButtonType.NEXT); 

it Umut -

swal({ 
    title: 'Are you sure?', 
    text: "You won't be able to revert this!", 
    type: 'warning', 
    showConfirmButton:false, 
    confirmButtonText: 'Yes, delete it!' 
}) 

İşte ('A' Uyarısı adını varsayarak) gibi yeniden eklemeniz sonra herhangi bir düğme, berrak bütün düğmeleri ve eklemeden önce fiddle

0

var yardım edeceğim!

1

Bu benim için çalışıyor: $(".confirm").attr('disabled', 'disabled');

Benim fonksiyonu:

function DeleteConfirm(c){ 
    swal({ 
      title: "Want to delete this item?", 
      text: "You will not be able to undo this action!", 
      type: "warning", 
      showCancelButton: true, 
      confirmButtonColor: "#DD6B55", 
      confirmButtonText: "Yes, delete it!", 
      closeOnConfirm: false 
     }, function(){ 
      $(".confirm").attr('disabled', 'disabled'); 

     }); 
}