本文转载自:https://www.cnblogs.com/zhangnianlei/p/12239258.html
layer用法
1.layer提示框
layer.msg("操作成功", {time:2000, icon:1}); //icon:0-2
2.ajax请求后成功刷新页面,失败提示信息(使用layer组件)
$.ajax({
type: "POST",
data: json,
contentType: 'application/json;charset=utf-8',
url: "${ctx!}/admin/voucher/select/delete",
success: function(msg){
msg = JSON.parse(msg);
if (msg.code == 0){
layer.msg(msg.message, {icon:1, time: 2000}, function () {
window.location.reload();
//table.bootstrapTable("refresh");
});
} else {
layer.msg(msg.message, {icon:2, time:2000})
}
}
});
3.layer确认框
layer.confirm('是否确认删除?', {btn: ['确认','取消']},
function(){
$.ajax({
type: "get",
contentType: 'application/json;charset=utf-8',
dataType: 'json',
url: "${ctx!}/admin/warning/apply/del/" + id,
success: function(msg){
if (msg.code == 0){
layer.msg(msg.message, {icon:1, time: 1000}, function () {
$table.bootstrapTable("refresh");
// window.location.reload();
});
} else {
layer.msg(msg.message, {icon:2, time:1000})
}
}
});
},
function () {
}
);
4.layer中打开网页
layer.open({
type: 2,
resize: true,
skin: 'layui-layer-rim', //加上边框
area: ['1000px', '800px'], //宽高
content: "http://www.baidu.com"
});
5.关闭当前层
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index);
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。
本文链接:https://www.jhelp.net/p/tyJJV5ZjPnyh5rn1 (转载请保留)。