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

BootstrapDialog的简单封装

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

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


相关文章

Idea快捷键

Idea快捷键

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

FileBeat6.3安装(Ubuntu)

FileBeat6.3安装(Ubuntu)

通过官方网站说明,他们是支持通过apt命令安装FileBeat的。官网地址:https://www.elastic.co/guide/en/beats/filebeat/current/setup-r...

maven 常用命令汇总

maven 常用命令汇总

1. 编译源代码: mvn compile 2. 编译测试代码: mvn test-compile 3. 运行测试: mvn test 4. 产生site:...

发表评论

访客

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