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

[RFC] 支持运行时修改 mountElementId #5020

Closed
2 tasks
kuitos opened this issue Jul 13, 2020 · 0 comments · Fixed by #5096
Closed
2 tasks

[RFC] 支持运行时修改 mountElementId #5020

kuitos opened this issue Jul 13, 2020 · 0 comments · Fixed by #5096
Assignees

Comments

@kuitos
Copy link
Member

kuitos commented Jul 13, 2020

背景

plugin-qiankun 的多实例场景,主应用会同时渲染多个 umi 子应用,而由于目前 umi 子应用的 mountElementId 是编译期固定的(plugin-qiankun 下子应用 root 节点默认为 root-slave),所以会存在 root id 冲突,导致子应用渲染冲突的问题

思路

qiankun 目前在生命周期钩子的 props 中提供了 props.container 用于表明子应用处于父应用的哪个容器节点下,如果 mountElementId 支持配置成运行时 function,可以在子应用 mount 阶段将 mountElementId 设置成 props.container.querySelector(mountElementId),示例参考 https://github.com/umijs/qiankun/blob/master/examples/react15/index.js#L22

跟进

  • some task
  • PR URL
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 a pull request may close this issue.

2 participants