- Notifications
You must be signed in to change notification settings - Fork 5k
/
Copy pathcomposables.d.ts
51 lines (45 loc) · 1.75 KB
/
composables.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
importtype{ComputedRef,Ref}from'vue'
importtype{Route,NavigationGuard,defaultasVueRouter}from'./index'
/**
* Returns the current route location. Equivalent to using `$route` inside templates.
*/
exportfunctionuseRoute(): Route
/**
* Returns the router instance. Equivalent to using `$router` inside templates.
*/
exportfunctionuseRouter(): VueRouter
/**
* Add a navigation guard that triggers whenever the current location is about to be updated. Similar to beforeRouteUpdate but can be used in any component. The guard is removed when the component is unmounted.
*
* @param updateGuard
*/
exportfunctiononBeforeRouteUpdate(updateGuard: NavigationGuard): void
/**
* Add a navigation guard that triggers whenever the component for the current location is about to be left. Similar to beforeRouteLeave but can be used in any component. The guard is removed when the component is unmounted.
*
* @param leaveGuard
*/
exportfunctiononBeforeRouteLeave(leaveGuard: NavigationGuard): void
exportinterfaceRouterLinkOptions{
/**
* Route Location the link should navigate to when clicked on.
*/
to: Route|Ref<Route>
/**
* Calls `router.replace` instead of `router.push`.
*/
replace?: boolean
}
/**
* Vue Router 4 `useLink()` function. Note the active behavior is different from Vue Router 3 as highlighted in the
* migration guide (https://router.vuejs.org/guide/migration/index.html#removal-of-the-exact-prop-in-router-link)
*
* @param props - object containing a `to` property with the location
*/
exportfunctionuseLink({ to, replace }: RouterLinkOptions): {
route: ComputedRef<Route>,
isActive: ComputedRef<boolean>,
isExactActive: ComputedRef<boolean>,
href: ComputedRef<string>,
navigate: ()=>Promise<void>,
}