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