layui获取弹出层页面中的js对象或方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/MaBanSheng/article/details/86673124

@TOClayui获取弹出层中的js对象或方法

打开一个弹出层

layer.open({
type: 2
,
title: “审核指标”
,
area: [“500px”, “300px”]
,
shade: 0.8
,
btn: [“送审”,“取消”]
,
btnAlign: ‘c’
,
content: “${ctx}/pc/business/depreceipt/toValidate.do?querydata=” + encodeURIComponent(encodeURIComponent(querydata))
,
yes: function(index, layero){
//do something
debugger;

                var busyType = $(layero).find("iframe")[0].contentWindow.busyType;

                layer.close(index);
            }
        });

弹出层说明

弹出层的按钮,我们可以在layer.open中定义,也可以在弹出层里定义,这里我们在layer.open中定义了,yes方法就是第一个按钮触发的方法。

重点说明

yes方法中,我们怎么获取弹出层中定义的js方法或者属性呢?
var busyType = $(layero).find(“iframe”)[0].contentWindow.busyType;
代码中,busyType是我弹出层中定义的js对象,如果想获取方法是一样的道理,重点是这条代码。

猜你喜欢

转载自blog.csdn.net/MaBanSheng/article/details/86673124