-
Notifications
You must be signed in to change notification settings - Fork 555
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的vue子应用进入路由时获取的from to为基座应用的 #1171
Comments
主应用和子应用都是hash路由吗 |
disable-memory-router就是native模式,设置方式参考 https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/browser-router |
主应用history路由,子应用哈希路由。disable-memory-router设置为true了,不设置不行,不设置会死循环。我是听说vite都作为主子应用时,应该要关闭虚拟路由 |
把micro-app url中的hash去掉,放到浏览器url上 |
在菜单点击事件中,这种在调用主应用的router.push(主应用的(不包含vite.config.js.base的)路由 + '#' + 子应用(不包含vite.config.js.base的)路由 ),能正常显示微应用。 但是还是那个问题, 如下图, 获取到的path是主应用的路由,不是子应用的路由,。此时我基座应用的入口页比如说是/system/role, 那这里的path就指的是/system/role。比如微应用的路由是/admin/role。得router.push('/system/role#/admin/role')才行。这个问题就导致了子应用一加载进来就是首页,所以怎么获取到微应用的那个路由,判定是微应用的接入口再push? 基座应用下的菜单都是路由表里循环生成的,有几个子菜单会接入微应用,获取不到子应用路径,还是说push采取写死路由的做法? 所以我这篇issue总结归纳一句话就是,菜单是循环生成的情况下, 有多个菜单接入了微应用, 总不能判断基座应用路由满足/a的情况下跳/a#/micro-routera, 基座应用路由满足/b,跳/b#/micro-routerb吧。怎么区分这个东西 #65 |
问题描述
复现步骤
配置了基座应用的BASE_URL为'/main/, 配置子应用的base为'/child/power/'
4.在基座引用中切到微应用所在的页面时,微应用中的router.beforeEach的to.path为'/', from.path为‘/’, window.location,这仨都指向的基座应用,导致子应用无法渲染
5.但是,此时将地址栏的末尾的/换成/admin/authority, 又能成功渲染了,一刷新网页就挂
上传截图
复现仓库
环境信息
The text was updated successfully, but these errors were encountered: