Layui父页面向子页面传参


废话不多说!直接上代码!

父窗体js

$('.mytable').on('click', '.editRow', function () {
        var table = $('#table_id_example').DataTable();
        var rowData = table.rows({selected: true}).data()[0];
        if (rowData) {
            layer.open({
                title: this.text,
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                area: [window.screen.width / 2 + 'px', window.screen.height / 2 + 'px'], //宽高
                maxmin: true, //开启最大化最小化按钮
                content: "taskDetail.html",
                success: function (layero, index) {
                    // 获取子页面的iframe
                    var iframe = window['layui-layer-iframe' + index];
                    // 向子页面的全局函数child传参
                    iframe.child(rowData);
                }
            })
        } else {
            alert("先选择行")
        }
    })

子窗体


<script>
    function child(d) {
      alert(d)
    //在这里你可以写你的jquery $(function(){ })   等等操作


    }
</script>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM