部分代码如下:
index = layui.layer.open({
title: title,
type: 2,
area: ['98%', '96%'],
content: '/Test/Test/TestForm',
success: function (layero, index) {
var body = layui.layer.getChildFrame('body', index);
//编辑
if (key) {
$.ajax({
type: 'get',
url: '/Test/Test/TestDan?key=' + key.ID,
//async: false,
success: function (res) {
//console.log(res.data);
body.find('.layui-form').formSerialize(res.data);
//获取iframe并进行render
//var iframeWin = window[layero.find('iframe')[0]['name']]与下面写法一样的值
var iframeWindow = layero.find('iframe')[0].contentWindow;
iframeWindow.layui.form.render();
....