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弹出层嵌套调用问题的实例代码
//首次调用
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弹出层嵌套调用问题的实例代码