子页面调用父页面方法、变量
window.parent.curVue.typography(); //在子页面中 window.parent变量就是父页面的全局上下文变量了 你可以拿到父页面中的所有
变量和方法等 我的代码中curVue是父页面的VUE实例 typography是vue中methods中的方法
父页面调用子页面方法
layer.open({
type : 2,
title : '页面标题',
shadeClose : true,
shade : false,
shadeClose : false,
maxmin : true,
area : ['30%', '800px'],
content :'pageSrc',
success:function(layero,index){
window[layero.find('iframe')[0]['name']].fitView(); //在layersuccess的回调中
window[layero.find('iframe')[0]['name']] 此对象就是该子页面的上下文环境 fiteView就是子页面的方法
在layer的 yes confirm等回调中均有此参数
},
});