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

主应用切换至vue3后,两个router冲突BUG #27

Open
L-orz opened this issue Nov 16, 2020 · 4 comments
Open

主应用切换至vue3后,两个router冲突BUG #27

L-orz opened this issue Nov 16, 2020 · 4 comments

Comments

@L-orz
Copy link

L-orz commented Nov 16, 2020

主应用+子应用都使用vue3并使用vue-router-next。点击子应用页面内的,会触发三次子应用的router.beforeEach钩子,且不会触发主应用router的router.beforeEach钩子。

@weizaily
Copy link

想问下作者知道这是啥问题没。我也用vue,使用qiankun后就是主应用会报找不到子应用的路由的警告,但是可以正常跳转。

@L-orz
Copy link
Author

L-orz commented Dec 1, 2020

router.beforeEach的问题解决了。原因是,主应用和子应用同时使用了view-router组件。为了同时使用router,主应用的view-router要用v-if进行判断。
同时发现另一个bug,两个[email protected] 实例,在页面点击返回时,会触发history.replaceState。导致先前记录的状态被另一个router篡改,导致返回跳转的地址错误。

@alanland
Copy link

router.beforeEach的问题解决了。原因是,主应用和子应用同时使用了view-router组件。为了同时使用router,主应用的view-router要用v-if进行判断。
同时发现另一个bug,两个[email protected] 实例,在页面点击返回时,会触发history.replaceState。导致先前记录的状态被另一个router篡改,导致返回跳转的地址错误。

我升级vue3之后也遇到了 子应用找不到路由警告主应用 router.beforeEach 不触发 的问题。主应用没有直接用<router-view>,只是升级了 vue和vue-router,请问 v-if 判断是判断的什么,怎么判断的?

我两个子应用和主应用都是 [email protected],但是没有出现你说的 history.replaceState的问题,页面返回是正常的。

@XingXiaoWu
Copy link

我也是主应用和子应用都vue3,路由有问题,我页面展示,跳转,代码控制全都正常,但是浏览器的前进后退键全都无效

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

4 participants