swal() 弹出层的用法

Easter79
• 阅读 574

swal()方法是一个提示框;

swal({ 
          title: "", 
          text: "请扫描用户手机上的付款码",
          type: "input", 
          showCancelButton: true, 
          closeOnConfirm: false, 
          cancelButtonText: "取消", 
          confirmButtonText: "确认", 
          imageUrl: "/assets/images/icon/scancode.gif",
          inputPlaceholder: "请填写付款码数字",
          showLoaderOnConfirm: true
        },function(inputValue){ 
            if(inputValue){
                if (inputValue === "") { 
                    swal.showInputError("请填写付款码数字");
                    return false 
                }else{
                    $("input[name='authCode']").val(inputValue);
                    var form = cashierFrom.serialize();
                    $.post("/cashier/order", form, function(data) {
                        var result = $.parseJSON(data);
                        if (result.code == 'SUCCESS') {
                            swal({
                                title : "支付成功",
                                type : "success",
                                confirmButtonText : "确定",
                                closeOnConfirm : false
                            });
                        } else {
                            if(result.subCode=='USER_PAYING'){
                                var html = '<div class="q-btn-box"><button type="button" class="btn btn-primary waves-effect waves-light">取消</button></div>';
                                showLoadAlert('等待用户输入密码..',html);
                                var no = result.outTradeNo;
                                queryInterval = self.setInterval("cashierOrderQuery('"+no+"',true)",3000);
                            }else{
                                swal({
                                    title : "支付失败",
                                    type : "error",
                                    text : result.msg,
                                    confirmButtonText : "确定",
                                    closeOnConfirm : false
                                });
                            }
                        }
                    });
                }
            }
        });

 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");
  }
});

  可参考地址:

http://www.dglives.com

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Wesley13 Wesley13
2年前
SQL条件语句(IF, CASE WHEN, IF NULL)
1.IF  表达式:IF(expr1,expr2,expr3)  expr1条件,条件为true,则值是expr2,false,值就是expr3SELECTo.id,u.account,catagory.name,orderTime,detail.amount,periodtime,if(direc
陈占占 陈占占
2年前
PHP 利用confirm删除指定数据库的数据
完整的效果图方法一a标签href中的是你要删除记录html<ahref"PHPtest.php?name1"onclick"returnconfirm('是否要移除该小说?')"方法二下面这个方法是js代码,点击获取id,弹出提示框,确定是否删除,confirm好像可以返回true或者falsejavascriptfunctiond
Wesley13 Wesley13
2年前
vant Popup弹框使用总结
1、基础用法通过vmodel控制弹出层是否展示<vancellislink@click"showPopup"展示弹出层</vancell<vanpopupvmodel"show"内容</vanpopupexportdefault{data(){
Stella981 Stella981
2年前
Html5添加三联切换仿3D效果旋转木马jQuery插件教程
一、使用方法<script type"text/javascript" src"js/jquery.min.js"</script<script type"text/javascript" src"js/gallery.js"</script   二、Html结构<div id"wrapper"<div id"mai
Stella981 Stella981
2年前
ASP.NET MVC 4 之 Jquery Ajax
//前台界面,一个下拉框,一根文本框<select id"SEX"    <option男</option    <option女</option    <option未知</option</select<input id "DESC"  type"text"/
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Stella981 Stella981
2年前
ELK学习笔记之配置logstash消费kafka多个topic并分别生成索引
0x00 filebeat配置多个topicfilebeat.prospectors:input_type:logencoding:GB2312fields_under_root:truefields:添加字段
Stella981 Stella981
2年前
Python学习之路
三元运算变量条件返回True的结果if条件else条件返回False,用于简单importtimetime.time()1970年至今多少秒time.sleep()暂时休眠装饰器形成过程!(https://oscimg.oschina.net/oscnet/3b8d3477779a33f0ffcefa35
Wesley13 Wesley13
2年前
Java多线程:线程属性
\线程属性id:线程唯一标识。自动生成。不允许修改。name:线程的名字,可以自定义成有具体含义的名字,便于识别不同作用的线程。(可同名)isDaemon:是否是守护线程。true守护线程,false用
Easter79
Easter79
Lv1
今生可爱与温柔,每一样都不能少。
文章
2.8k
粉丝
5
获赞
1.2k