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

[Feature Request] 运行时支持动态修改 QiankunState #11051

Open
KuangPF opened this issue Apr 26, 2023 · 2 comments
Open

[Feature Request] 运行时支持动态修改 QiankunState #11051

KuangPF opened this issue Apr 26, 2023 · 2 comments

Comments

@KuangPF
Copy link

KuangPF commented Apr 26, 2023

Background

基于 umi 以及 qiankun 插件搭建微前端主应用,想在主应用中维护一台整体的系统配置(例如主题色)。在 app.ts 中使用 useQiankunStateForSlave 初始化全局配置 globalConfig,然后在子应用中使用 useModel('@@qiankunStateFromMaster') 获取 globalConfig 值,然后进行相关 <ConfigProvider /> 配置。
初始化获取配置目前是满足的,但如果我想在运行时动态改变globalConfig,并且子应用能够进行相关的 update,并获取更新后的值,目前没有找到比较合适的方法,想确定下官方目前有没有比较好的解决思路,thanks。

Proposal

not yet!

Additional context

Add any other context or screenshots about the feature request here.

@fz6m
Copy link
Contributor

fz6m commented Apr 26, 2023

考虑在主应用给全局挂上:① 获取当前最新变量表的函数;② 注册 callback 的地方,用来回调下发。

然后在子应用初始化的时候注册一下 callback ,修改之后,触发所有 callback 下发最新的主题,可以把 antd 的 provider 什么的抽出来第三方包用,这些逻辑都 cover 住。

@KuangPF
Copy link
Author

KuangPF commented Apr 26, 2023

全局指的是在主应用 window上维护一套修改更新以及 callback 的逻辑么🤔️

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

No branches or pull requests

2 participants