swal用法

swal({title: "确认删除?",text: "Your will not be able to recover this imaginary file!",type: "warning",showCancelButton: true,confirmButtonColor: "#DD6B55",confirmButtonText: "确认",   cancelButtonText: "取消",   closeOnConfirm: false,   closeOnCancel: false }, function(isConfirm){   if (isConfirm) {     swal("Deleted!", "Your imaginary file has been deleted.", "success");   } else {     swal("Cancelled", "Your imaginary file is safe :)", "error");   } }); function edit(){     swal({         title: "编辑订单",         text: "修改订单金额",         type: "input",         showCancelButton:true,         closeOnConfirm:false,         confirmButtonText:"确认",         cancelButtonText:"取消",         animation: "slide-from-top",         inputPlaceholder: "输入订单金额"     },     function (inputValue){         if(inputValue){             var re = /^[1-9]+[0-9]*]*$/;             if(!re.test(inputValue)){                 swal("订单金额只能是一个正整数");             }else{                 swal(inputValue);             }                          }else{             swal("输入不能为空");                      }     }          ); } 

可参考地址:

 

http://www.dglives.com/demo/sweetalert-master/example/

转载于:https://www.cnblogs.com/telwanggs/p/7513526.html

Published by

风君子

独自遨游何稽首 揭天掀地慰生平