1 Star 0 Fork 0

iukcy/base-plug

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
base-layer.js 3.08 KB
一键复制 编辑 原始数据 按行查看 历史
iukcy 提交于 2017-12-22 11:03 +08:00 . 初始导入
/**
* 基本layer封装类
* 基于layer2.2版本
* @author bats
* @datetime 2016-4-7 17:32:09
*
*/
var baseLayer = {
// layer警告框(无刷新)
_alert : function(msg, time, state) {
layer.msg(msg, {
icon : state,
time : time
// 默认延迟(单位毫秒)
});
},
// layer警告框(刷新本页面)
_alert_reflush : function(msg, time, state) {
layer.msg(msg, {
icon : state,
time : time
// 默认延迟(单位毫秒)
}, function() {
window.location.reload();
});
},
// layer警告框(跳转其他页面)
_alert_goto : function(msg, time, state, url) {
layer.msg(msg, {
icon : state,
time : time
// 默认延迟(单位毫秒)
}, function() {
window.location.href = url;
});
},
// layer警告框(根据表单刷新列表页面)
_alert_goto_form : function(msg, time, state, _formId) {
layer.msg(msg, {
icon : state,
time : time
// 默认延迟(单位毫秒)
}, function() {
$("#" + _formId).submit();
});
},
// layer警告框(清空表单)
_alert_form : function(msg, time, state, formId) {
layer.msg(msg, {
icon : state,
time : time
// 默认延迟(单位毫秒)
}, function() {
document.getElementById(formId).reset();
window.location.reload();
});
},
// layer确认框-默认标题
_confirm : function(callback, massages) {
layer.confirm(massages || '确定执行此操作吗?', {
icon : 3,
title : '提示'
}, function(index) {
if (typeof callback == 'function') {
callback();
}
layer.close(index);
});
},
// layer确认框-自定义标题
_confirm2 : function(tit, callback) {
layer.confirm(tit, {
icon : 3,
title : '提示'
}, function(index) {
if (typeof callback == 'function') {
callback();
}
layer.close(index);
});
},
// 页面层
_custom : function(content) {
// layer 页面层
layer.open({
type : 0,
skin : 'layui-layer-rim', // 加上边框
area : [ '420px', '240px' ], // 宽高
content : content
});
},
_custom_1 : function(_title, _content, _dom_id) {
layer.open({
title : _title,
type : 0,
skin : 'layui-layer-rim', // 加上边框
area : [ '420px', '280px' ], // 宽高
content : _content,
btn : [ '确定' ],
yes : function(index, layero) {
$("#" + _dom_id).submit();
}
});
},
// 弹出DOM元素
_custom2 : function(_title, _content) {
// layer 页面层
layer.open({
title : _title,
type : 1,
skin : 'layui-layer-rim', // 加上边框
area : [ '700px', '500px' ], // 宽高
content : _content
});
},
_custom3 : function(_title, _content, callBack) {
layer.open({
title : _title,
type : 1,
skin : 'layui-layer-rim', // 加上边框
area : [ '750px', '410px' ], // 宽高
content : _content,
btn : [ '确定' ],
yes : function(index, layero) {
if (typeof callBack == 'function') {
callBack();
layer.close(index);
}
}
});
},
// layer关闭
_close : function(_closeIndex) {
layer.close(_closeIndex);
},
// layer弹出tips
_tips : function(_content, _this, _param) {
layer.tips(_content, _this, _param);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/iukcy/base-plug.git
git@gitee.com:iukcy/base-plug.git
iukcy
base-plug
base-plug
master

搜索帮助