aliyun / alibabacloud-alfa

阿里云微前端解决方案
https://aliyun.github.io/alibabacloud-alfa
MIT License
846 stars 83 forks source link

在同一个区域切换子应用的示例 #78

Closed rivers-fighting closed 3 years ago

rivers-fighting commented 3 years ago

如下图,请问有没有在body区域动态切换子应用的示例代码?谢谢 image

Boelroy commented 3 years ago

这个看你具体是什么框架,具体思路是目前 Application 的是用方式就是个纯组件,你可以通过路由切换来选择展示不同组件的道理是一样的,你可以通过切换路由来切换子应用

rivers-fighting commented 3 years ago

这个看你具体是什么框架,具体思路是目前 Application 的是用方式就是个纯组件,你可以通过路由切换来选择展示不同组件的道理是一样的,你可以通过切换路由来切换子应用

我们这边是选择的react技术栈

如果有n个子应用,就创建n个application吗,内存方面会不会有问题?能不能n个子应用公用同一个application,让它可以动态加载和卸载不同的子应用。能不能麻烦抽时间写一个示例,谢谢!@Boelroy

Boelroy commented 2 years ago

这里可以传递 子应用的 初始路径 来选择加载到那个子应用 https://github.com/aliyun/alibabacloud-alfa/blob/master/example/HostApp/ReactHost/src/index.js#L21

Boelroy commented 2 years ago

n 个子应用也不会有问题,我们会正常的去卸载掉子应用中的内存占用 所以不会出现内存问题