Skip to content
New issue

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

feat: Micro front-end pop-up mount container #22666

Closed
wants to merge 1 commit into from

Conversation

wangdaodao
Copy link
Contributor

@wangdaodao wangdaodao commented Sep 5, 2023

Please make sure these boxes are checked before submitting your PR, thank you!

针对微前端子应用浮窗逃逸到主应用,导致微前端开启实验性的样式隔离后子应用无法控制浮窗类样式。

类似于Ant Design of Vue 中的 getPopupContainer 配置。

在全局配置中增加 content 字段,挂载到 body 的浮窗都会挂载到 content 指定的容器中:

图片

图片

Vue.use(Element, { content: 'content' });
<template>
  <div id="app">
    <!-- 原来的逻辑 -->
    ...
    <!-- 挂载容器,如果忘记,会自动挂载到 body 中 -->
    <div id="content"></div>
  </div>
</template>

这样处理后,改动量小,对于没有配置或者配置字段没有配置挂载容器,组件做了兼容性处。

  • Make sure you follow Element's contributing guide (中文 | English | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer relative issues for you PR.

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

🎊 PR Preview has been successfully built and deployed to https://preview-pr-22666-element-ui.surge.sh

@wangdaodao
Copy link
Contributor Author

wangdaodao commented Sep 7, 2023

@xinguanhua 看下目前这种解决微前端挂载方案是否可行,目前老产品项目使用微前端整合较多,其他的开源组件也有类似的解决方案。我们已经在产品中小范围实践了,对产品改动较小,不影响原有的逻辑。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant