We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第一次发送数据
window.microApp?.dispatch({ siderShow: true, item: { _blank: true, customKey: 'goPage', }, appName: 'chartApp', });
主应用通过handleDataChange监听数据
handleDataChange
<micro-app v-if="activeApp" :name="activeApp.name" :url="activeApp.url" :baseroute="activeApp.baseRoute" :inline="activeApp.isVite" :disable-sandbox="activeApp.isVite" :data="microData" @created="handleCreate" @beforemount="handleBeforeMount" @mounted="handleMounted" @unmount="handleUnMount" @error="handleError" @datachange="handleDataChange" class="micro-app-container" /> function handleDataChange(e: CustomEvent): void { console.log('来自子应用 child-vite 的数据:', e.detail?.data); const { item, appName } = e.detail?.data; // 子应用协作空间 的动态 传递kinds 用于跳转 if (['teamSpaceApp', 'chartApp'].includes(appName) && item?.customKey == 'goPage') { const res = getRoute(item); if (res) { // _blank打开新窗口 if (item?._blank) { const resolve = router.resolve(res); window.open(resolve.href, '_blank'); } else router.push(res); } } }
主应用接受数据正常
// 接受到的数据 { siderShow: true, item: { _blank: true, customKey: 'goPage', }, appName: 'chartApp', }
第二次发送数据
window.microApp?.dispatch({ test: 'test' });
// 接受到的数据 { test: 'test', siderShow: true, item: { _blank: true, customKey: 'goPage', }, appName: 'chartApp', }
为什么会把第一次的数据与第二次的数据合并,为什么要这样设计,设计初衷是什么
The text was updated successfully, but these errors were encountered:
这个不能当传统的事件系统来使用,其实是用来同步数据的 merge数据为了让你每次得到的数据都是全量 由于只是merge第一层数据,你可以把数据放到event的更深层次结构中,避免被merge 如果可以的话,建议自己实现事件系统
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
第一次发送数据
主应用通过
handleDataChange
监听数据主应用接受数据正常
第二次发送数据
为什么会把第一次的数据与第二次的数据合并,为什么要这样设计,设计初衷是什么
The text was updated successfully, but these errors were encountered: