]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: onBeforeRoute*
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 28 Apr 2020 09:29:35 +0000 (11:29 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 28 Apr 2020 09:29:35 +0000 (11:29 +0200)
src/navigationGuards.ts

index a5c78ec54dc66aaeca3ae2bce79d6d9345c4bd43..a2e46667c4f0f304e0a645f559f79be06e513dfb 100644 (file)
@@ -22,6 +22,13 @@ import { matchedRouteKey } from './injectionSymbols'
 import { RouteRecordNormalized } from './matcher/types'
 import { isESModule } from './utils'
 
+/**
+ * Add a navigation guard that triggers whenever the current location is
+ * left. Similarly to {@link beforeRouteLeave}, it has access to the
+ * component instance as `this`.
+ *
+ * @param leaveGuard {@link NavigationGuard}
+ */
 export function onBeforeRouteLeave(leaveGuard: NavigationGuard) {
   const instance = getCurrentInstance()
   if (!instance) {
@@ -47,6 +54,13 @@ export function onBeforeRouteLeave(leaveGuard: NavigationGuard) {
   )
 }
 
+/**
+ * Add a navigation guard that triggers whenever the current location is
+ * updated. Similarly to {@link beforeRouteUpdate}, it has access to the
+ * component instance as `this`.
+ *
+ * @param updateGuard {@link NavigationGuard}
+ */
 export function onBeforeRouteUpdate(updateGuard: NavigationGuard) {
   const instance = getCurrentInstance()
   if (!instance) {