如下粗體的部分

Just add your custom function to catch the rejection, for example:

 

swal({
   title: 'Some title',
   text: 'some text for the popup',
   type: 'warning',
   showCancelButton: true,
   cancelButtonText: 'Some text for cancel button'
}).then(function(){
   // function when confirm button clicked
}, function(dismiss){
   if(dismiss == 'cancel'){
       // function when cancel button is clicked
   }
});

 

You can even add more function to catch another dismiss event, just read SweetAlert2 Docs for more info about dismiss event.

--

https://stackoverflow.com/questions/42378426/sweetalert2-bind-another-event-to-cancel-button

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 dizzy03 的頭像
    dizzy03

    碎碎念

    dizzy03 發表在 痞客邦 留言(0) 人氣()