Description
What problem does this feature solve?
Some time, we watn remove history listener manaul.
For example, in qiankun micro-front. Main-app and sub-app both vue, and beforeRoute guard with main-app. I passed the history
and router
of the main-app to the sub-app. The sub-app used the history
of the main-app, and created the router
itself, which caused the route guard in the main-app to fire twice
Example:
https://github.com/beiifeng/vue-router-next-report
Followe readme , from 首页
to Home
, then to 首页
,we find BasicLayout:afterEach /Home
once in console. But find BasicLayout:afterEach
twice after we switch to PppDemo1
. Sys2Demo1
and Sys2Demo2
is used api I want, only print once.
It's my commit: https://github.com/beiifeng/vue-router-next/commit/b4cbbd0b80e3713aca45cb8cfa294b037aaa679c
What does the proposed API look like?
router = createRouter({
history,
routes,
});
router.removeHistoryListener();