layui——弹出层
$("#createUser").click(function () {
layer.open({
type:2
,title: '新增用户'
,content: ['./admin-userCreate.html', 'no']
,area: ['500px', '500px']
});
});
type - 基本层类型
类型:Number,默认:0
layer提供了5种层类型。可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)。 若你采用layer.open({type: 1})方式调用,则type为必填项(信息框除外)
layer.open({// 弹出“保存成功!”
title: ''
,content: '保存成功!'
,yes: function(index, layero){// 确定后回调
var index = parent.layer.getFrameIndex(window.name);// 先得到当前iframe层的索引
parent.layer.close(index);// 关闭当前弹出层
window.parent.location.reload();// 刷新父级页面
}
});
传递数据到弹出层:
if (data.status == "1") {
switch (data.data.permissionLevel) {
case 0:
body.find("#guest").attr("checked", true);
break;
case 1:
body.find("#vip").attr("checked", true);
break;
case 2:
body.find("#admin").attr("checked", true);
break;
}
body.find("#userId").val(userId);
body.find("#userName").val(data.data.userName);
body.find("#nickname").val(data.data.nickname);
body.find("#email").val(data.data.email);
body.find("#cellphone").val(data.data.phone);
layui.form.render('radio');
}
还没有评论,来说两句吧...