Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

样式丢失 #755

Open
UtherPim opened this issue Sep 23, 2024 · 2 comments
Open

样式丢失 #755

UtherPim opened this issue Sep 23, 2024 · 2 comments

Comments

@UtherPim
Copy link

bug

复现过程

  1. 主应用使用vue3 + antd构建;
  2. 子应用使用react18 + antd5 + other(内部基于antd4封装的组件库);
  3. 子应用覆写unmount函数,特意不执行root.unmount()卸载子应用(发现这样可以缓存react子应用页面状态)
    export function unmount() {console.log('unmount ')}
  4. 从子应用A切换到别的子应用B再切回该子应用A离开时的路由,出现样式丢失,自己写的module.css样式和antd5(用了prefixCls)框架的样式,都丢了

期望

  1. 切换子应用后样式不丢,正常展示。
  2. 或者是否有缓存子应用所有状态的方案?
  3. 或者能说明一下子应用切换时做了啥事情吗?
@ClarkXia
Copy link
Collaborator

如果样式是异步加载进来的,框架无法识别该样式在应用切换的时候是否移除,可以通过额外的 API 进行标记 shouldAssetsRemove

@UtherPim
Copy link
Author

@ClarkXia

如果样式是异步加载进来的,框架无法识别该样式在应用切换的时候是否移除,可以通过额外的 API 进行标记 shouldAssetsRemove

这个需要在主应用中配置,因为跨部门合作问题,我们无法修改主应用代码,有什么别的方法吗

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

No branches or pull requests

2 participants