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

刷新页面,子应用随机白屏 #1200

Open
SepVeneto opened this issue May 9, 2024 · 0 comments
Open

刷新页面,子应用随机白屏 #1200

SepVeneto opened this issue May 9, 2024 · 0 comments
Labels

Comments

@SepVeneto
Copy link
Contributor

问题描述

当子应用的index.html中使用document.write时,刷新页面后,子应用会随机白屏。

<head>
  <script>
      window.document.write('<meta name="viewport" content="width=device-width, initial-scale=1.0" />')
  </script>
</head>

刷新后观察到当白屏时子应用的iframe中原来的

<head>
  <base href="http://localhost:8988/">
</head>
<body>
</body>

变为

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

导致后续js挂载到body时执行失败,无法进行渲染操作

复现步骤

克隆复现仓库

pnpm i
cd packages/base
pnpm dev

cd packages/micro
pnpm dev

访问http://localhost:8987

重复刷新浏览器,会随机观察到子应用白屏

上传截图

请上传代码截图、控制台、终端等截图以帮助我们了解您的问题。

复现仓库

microapp-demo

环境信息

  • micro-app版本:1.0.0-rc.5
  • 主应用前端框架&版本:vue&3.4.27
  • 子应用前端框架&版本:vue&3.4.27
  • 构建工具&版本:vite&5.2.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants