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

vite as child not mount #1

Open
JackShell2020 opened this issue Aug 9, 2024 · 0 comments
Open

vite as child not mount #1

JackShell2020 opened this issue Aug 9, 2024 · 0 comments

Comments

@JackShell2020
Copy link

用你代码,主应用启动 vue2, 子应用启动3个(sidebarvite-vue3vue2
说下vite-vue3中的这段

// src/main
// 微前端环境下,注册mount和unmount方法
if (window.__MICRO_APP_BASE_APPLICATION__) {
  // @ts-ignore
  window['micro-app-appname-vite'] = { mount, unmount }
} else {
  // 非微前端环境直接渲染
  mount()
}
  1. 判断确实命中了 if,但页面并没有渲染,没有执行mount,但主应用中的@mounted='handleMount'却执行了,在控制台看到window['micro-app-appname-vite'] 有值
  2. 如果这里不走判断,直接执行 mount(),子应用挂载正常渲染,但切别的子应用时没有走unmount
  3. 你readme中的线上demo,可以看到是正常挂载渲染的,卸载时也正常走unmount,而且你demo好像并不是这个仓库。

vite 肯定是可以作为vue2的子应用的,因为你有demo可以,期望你们并没有放出demo的代码,或者修复一下当前仓库

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

1 participant