Components
Composables
onBeforeRouteUpdate
Register a guard that is removed automatically when its Vue scope ends.
function onBeforeRouteUpdate(guard: NavigationGuard): voidonBeforeRouteUpdate((to, from) => {
if (to.params.id !== from.params.id) {
refresh();
}
});In the current implementation, Runable registers the guard with router.beforeEach() and removes it with onScopeDispose(). It is therefore a global guard whose lifetime follows the calling scope.