1、iframe的通信
如何引入
<iframe id="svgiframe" :src="网址">IE:你们都看我干吗,我现在也是支持的</iframe>
如何通信
父页面发送给iframe页面的消息:
iframe.contentWindow.postMessage({ type: 'boundFileKeys', data: "消息内容体" }, '*');
父页面监听iframe消息:
window.addEventListener('message', receiveMessageIframePage, false);
iframe页面监听父页面发过来的消息
window.addEventListener('message', onMessage, false);
iframe页面给父页面发送消息:
window.parent.postMessage({ type: 'check', data: ["自定义需要发送的数据"] }, '*');
iframe加载完成的回调
iframe.onload = function () {}