Session

layer弹窗 获取frames的值

电脑版发表于:2021/3/17 15:34

通过window.frames["name"]可以调用layer弹页窗指向页面的方法

 //例如目标页面存在一个方法
 var update = function ()
 {
     alert("hello");
 }

弹窗主页面调用

 window.frames["name"].update()

注意:layer弹窗生成的盒子每一次生成的名字都不同,所以名字需要是动态的

  layer.open({
            title: '修改',
            skin: 'layui-layer-lan',
            area: ['470px', '280px'],
            btn: ['确定', '取消'],
            type: 2,
            content: "目标页面",
            yes: function myfunction(index) {
                    //index表示弹窗次数
                window.frames["layui-layer-iframe" + index].update();
                
                
                });
                
                 //关闭所有layer
                layer.closeAll();
            },



关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢