父页面的yes回调函数需要调用子页面的方法,获取子页面参数,一直按照网上方法就是获取不到。
$(function(){
$('.addSupplierBtn').click(function(){
var url = "/relation/getSupplierList?productId=" + $("#productId").val();
layer.open({
type: 2,
area:['700px','550px'],
title: '添加供应商',
closeBtn: 1,
shadeClose: true,
anim:0,
btn:['确定','取消'],
content: [url,"yes"],
yes: function(index, layero){
var body = layer.getChildFrame('body', index);
var iframeWin = window[layero.find('iframe')[0]['name']];
iframeWin.sureChoose();
layer.close(index);
}
});
});
})
最终发现子页面的sureChoose()方法写到了子页面的$(function(){})函数中,移到函数体外就可以了。