layer弹出层嵌套调用问题的实例代码layer弹出层嵌套调用问题的实例代码 //首次调用layer.open({ type: 2, title: '打印', content: '/Account/AddPrintInfo?cardId=' + data.Base_CardId, area: ['90%', '30%'], success: function (layero, index) { }, end: function () { }, btn: ['确定','关闭'] , yes: function (index, layero) {
//首次调用
layer.open({
type: 2,
title: '打印',
content: '/Account/AddPrintInfo?cardId=' + data.Base_CardId,
area: ['90%', '30%'],
success: function (layero, index) {
},
end: function () {
},
btn: ['确定','关闭']
, yes: function (index, layero) {
var thisIndex = index;
layer.confirm('确定保存么', { icon: 3, title: '提示' }, function (index) {
var body = layer.getChildFrame('body', index);
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();]
if (iframeWin.AddPrintInfoAction()) {
//关闭confirm
layer.close(index);
setTimeout(function () {
//关闭layer
layer.close(thisIndex);
//当弹出的第一个页面完成操作后判断结果,如果结果为真则关闭之前弹出的内容,弹出新的内容页(第二次调用)
layer.open({
type: 2,
title: '打印',
content: '/Account/AddPrintInfoPage?cardId=' + data.Base_CardId,
area: ['98%', '98%'],
success: function (layero, index) {
},
end: function () {
},
btn: ['打印']
, btn1: function (index, layero) {
var body = layer.getChildFrame('body', index);
console.log("layero", layero);
//此处在回调中获得的layero,为当前弹出层的内容,通过该内容获取iframe标签信息,与单层弹出相同
var iframeWin = window[layero.find('iframe')[0]['name']];
console.log("iframeWin", iframeWin);
iframeWin.printPage();
}
});
}, 2 * 1100);
}
else {
layer.close(index);
return false;
}
});
}
});
沃梦达教程
本文标题为:layer弹出层嵌套调用问题的实例代码
基础教程推荐
猜你喜欢
- Bootstrap警报中的链接 1970-01-01
- Bootstrap .dropup类 1970-01-01
- Bootstrap - Dropdown插件切换 1970-01-01
- Bootstrap缩略图(Thumbnail) 1970-01-01
- javascript实现for循环倒序输出数组内容 2022-07-24
- D3.js圆形图 1970-01-01
- Bootstrap Split按钮下拉列表 1970-01-01
- Bootstrap大输入组 1970-01-01
- Bootstrap复选框和单选按钮 1970-01-01
- Bootstrap分页对齐链接 1970-01-01