1、主应用通过在iframe的onload事件中,使用postMessage向子应用进行数据交互
2、子应用在mounted阶段通过监听onmessage事件进行接收事件
主应用
<template>
<div v-tip="loading" :style="'height:' + (isQiankun ? qiankunHeight : height)">
<iframe
ref="iframe"
:src="src"
frameborder="no"
style="width: 100%;height: 100%"
scrolling="auto"
@load="loaded"
/>
</div>
</template>
<script>
// import Cookies from 'js-cookie'
export default {
props: {
src: {
type: String,
required: true
}
},
data() {
return {
height: document.documentElement.clientHeight - 90 + 'px;',