-
Notifications
You must be signed in to change notification settings - Fork 2k
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
主应用使用vue,并且使用了路由懒加载 #517
Comments
提供可复现仓库 |
遇到了相同的问题,看了下,是因为document.head.appendChild被改写了,导致vue-style-loader没有把样式加到正确的节点上。@kuitos 有什么建议吗? |
vue-router在路由变化之前加载资源,加载完毕再跳转。因为路由没有变化,qiankun判断微应用还是activated状态,用newAppendChild加载css。
我觉得是不是可以加一个手动卸载微应用的方法?@Deturium |
目前解决这个问题的临时方案如下: |
应该考虑从沙箱内部做隔离,在修正引导阶段的副作用的时候,可以考虑通过 assetPublicPath 隔离站点资源。 // only hijack dynamic style injection when app activated
if (
activated &&
stylesheetElement.baseURI.startsWith(assetPublicPath)
) {
dynamicStyleSheetElements.push(stylesheetElement);
const appWrapper = getWrapperElement(appName);
assertElementExist(appName, appWrapper);
return rawAppendChild.call(appWrapper, stylesheetElement) as T;
} |
遇到了相同的问题,在不同的子应用来回切换,会引发样式丢失现象 |
|
我也遇到了这种问题,有解决办法吗? |
测试了一下,动态样式丢失的情况出现在 dynamicAppend.ts 最后一行 rebuild 中的处理,
子应用切换的时候,有的样式是在动态加载的 js 脚本里创建的,这个时候 mounting 为 true,导致缓存的样式被清理掉了,第二次切换样式就会丢失(貌似第二次加载也不会再通过动态 js 去创建了)。 |
What happens?
主应用使用vue,并且使用了路由懒加载,当子应用加载之后,切换主应用的路由,相对应懒加载的组件样式不加载
复现
1.在加载子应用之后切换到该页面
![image](https://user-images.githubusercontent.com/55657083/80301318-f962b180-87d5-11ea-8dcd-826d12c6c258.png)
2.加载子应用之前点击切换到该页面
![image](https://user-images.githubusercontent.com/55657083/80301342-2fa03100-87d6-11ea-8fde-3bbb8fce3a6f.png)
相关环境信息
The text was updated successfully, but these errors were encountered: