Skip to content

Differences from Vue Router ​

Vue Routervue-router-ns
createWebHistory() and friendsNo history option: the native stack is the history.
<RouterView> swaps components<RouterView> is a Frame. Every navigation is a page in its stack.
useRoute() is the current routeInside a page, it's that page's route.
onBeforeRouteLeave runs on any departureRuns when the page leaves the stack. A push on top keeps it alive.
onBeforeRouteUpdateNot available: different params mean a new page.
router.forward(), go(n > 0)There is no forward history.
Nested <RouterView> through childrenchildren nest paths and merge meta. Nested UI is another <RouterView>.
beforeEnter runs on back navigationsGoing back reveals a page that already exists, so only leave guards and global guards run.
A guard redirect during backBecomes a push to the redirect target.
next() in guardsReturn values only.
Unknown paths render nothingpush rejects with No route matches. Add a catch-all route (/:pathMatch(.*)*) if you want a not-found page.
scrollBehaviorNot applicable. hash is kept in locations for parity.

What's only here ​

backTo(), backToRoot(), setStack(), pushForResult(), back({ result }), onPageActivated(), onPageDeactivated(), useBackGesture(), modal routes, named frames, withParents, restore, and a reactive router.stack.

Released under the MIT License.