One: Manipulate DOM across iframes
window.parent.document.getElementById('id').style.zIndex = '100';
If the domain names of the two iframes are different, an error will be reported
Two: Pass parameters across iframes
1. The child iframe passes parameters to the parent
// 子iframe,发送方:
window.postMessage("hello", "http://localhost:8081");
// 父iframe, 接收方:
window.addEventListener( "message",
(e)=>{console.log(e.data)}
false);
2. Pass values from the parent iframe to the child iframe
直接在iframe的src数属性中拼接上参数
// 发送方:
<div>
<iframe :src="url" id="childFrame" importance="high" name="demo" ></iframe>
</div>
url = `http://localhost:8080/couponManager?a={a}` //
接收方:直接使用window.location.search接收,然后对接收到的进行处理