封装bootstrap-dialog.js中的3个提示框

这里主要对项目中常用的3个提示框进行了封装,成功提示框,错误提示框和选择提示框:

 

//弹出错误提示的登录框
$.showErr = function (str, func) {
// 调用show方法
BootstrapDialog.show({
type: BootstrapDialog.TYPE_DANGER,
title: "错误 ",
message: str,
size: BootstrapDialog.SIZE_SMALL, //size为小,默认的对话框比较宽
buttons: [{
// 设置关闭按钮
label: "关闭",
action: function (dialogItself) {
dialogItself.close();
}
}],
// 指定时间内可自动关闭
onshown: function (dialogRef) {
setTimeout(function () {
dialogRef.close();
}, 3000);
},
// 对话框关闭时带入callback方法
onhide: func
});
};
//弹出确认框
$.showSuccessTimeout = function (str, func) {
BootstrapDialog.show({
type: BootstrapDialog.TYPE_SUCCESS,
title: "成功 ",
message: str,
size: BootstrapDialog.SIZE_SMALL,
buttons: [{
label: "确定",
action: function (dialogItself) {
dialogItself.close();
}
}],
// 指定时间内可自动关闭
onshown: function (dialogRef) {
setTimeout(function () {
dialogRef.close();
}, 3000);
},
onhide: func
});
};

//弹出提示框
$.showPromptTimeout = function (str, cb) {
BootstrapDialog.confirm({
title: '提示',
message: str,
type: BootstrapDialog.TYPE_SUCCESS,
size: BootstrapDialog.SIZE_SMALL,
btnCancelLabel: '取消',
btnOKLabel: '确定',
closeByBackdrop: false,
closable: true,
draggable: true,
callback: cb
});
return true;
};

转载于:https://www.cnblogs.com/HoredCX/p/10129882.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值