当前位置:首页 > 未命名 > 正文内容

BootstrapDialog的简单封装

淙嶙7年前 (2018-07-04)未命名531

类似alert的提示弹出框

$.dialogShow = function (msg,callBack,title) {
  if(typeof title == "undefined"){
      title = '警告';
   }
   BootstrapDialog.show({
      title: title,
      type: BootstrapDialog.TYPE_WARNING,
      size: BootstrapDialog.SIZE_SMALL,
      realized:false,
      message: msg,
      buttons: [{
         label: '确定',
         cssClass: 'btn-warning btn-sm',
         action: function (dialogItself) {
            dialogItself.close();
            if (typeof callBack != "undefined"){
               callBack.call();
            }
         }
      }]
   });
   return false;
};

确认框

$.dialogConfirm = function(msg,okCallBack,title){
   if(typeof title == "undefined"){
      title = '确认';
   }
   BootstrapDialog.confirm({
      title : title,
      message : msg,
      type : BootstrapDialog.TYPE_WARNING,
      closable : true, //默认false,点击对话框以外的页面内容可关闭
      draggable : true, //默认false,可拖拽
      btnCancelLabel : '取消', //默认'Cancel',
      btnOKLabel : '确定', // 默认'OK',
      btnOKClass : 'btn-warning btn-sm', // 确定按钮的样式
      size : BootstrapDialog.SIZE_SMALL,
      // 对话框关闭的时候执行方法
      callback : function(result){
         if (result){
            okCallBack.call();//点击确定按钮,发起的调用事件
         }
      }
   });
}

调用方式:

$.dialogConfirm("1222",function(){
    $.dialogShow("success");
});


相关文章

分库分表需要考虑的问题及方案

分库分表需要考虑的问题及方案

为什么要分库分表?解决单一数据库的性能问题。(通过分摊的思想解决独抗性能问题,分而治之)不管说是一个数据库还是说一台服务器,(CPU,磁盘,内存,IO)性能终究又上限,而使用中或预计使用中又达到了这个...

Ubuntu安装docker

Ubuntu安装docker

1.查看ubuntu版本,官方指定的版本才能安装。https://docs.docker.com/install/linux/docker-ce/ubuntu/To install Docker CE...

交叉队列

交叉队列

描述 给出三个队列 s1,s2,s3 ,判断 s3 是否是由 s1 和 s2 交叉得来。如:s1 为 aabcc , s2 为 dbbca。当 s3 为 aadbbcbcac 时,返回 true...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。