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

BootstrapDialog的简单封装

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

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


相关文章

在虚拟机里新安装Ubuntu无法全屏问题

在虚拟机里新安装Ubuntu无法全屏问题

除了本文外还有一种 完美解决Ubuntu16.04虚拟机窗口全屏问题,或者安装VMware Tools,单个人感觉还是简单就好,所以选择敲个命令完事。(转)在win7中用虚拟机安装了Ubuntu 16...

交叉队列

交叉队列

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

Idea快捷键

Idea快捷键

Ctrl+Alt+左键/光标 进入方法对应的实现类 对应eclipse Ctrl + 左键Ctrl+Alt+b         &...

发表评论

访客

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