|
| 1 | +# Function |
| 2 | + |
| 3 | +## createMemoryHistory |
| 4 | + |
| 5 | +Creates a in-memory based history. The main purpose of this history is to handle SSR. It starts in a special ___location that is nowhere. It's up to the user to replace that ___location with the starter ___location. |
| 6 | + |
| 7 | +**Signature:** |
| 8 | +```typescript |
| 9 | +export declare function createMemoryHistory(base?: string): RouterHistory; |
| 10 | +``` |
| 11 | + |
| 12 | +### Parameters |
| 13 | + |
| 14 | +| Parameter | Type | Description | |
| 15 | +| --- | --- | --- | |
| 16 | +| base | string | Base applied to all urls, defaults to '/' | |
| 17 | + |
| 18 | +### Returns |
| 19 | + |
| 20 | + a history object that can be passed to the router constructor |
| 21 | + |
| 22 | +## createRouter |
| 23 | + |
| 24 | +Create a Router instance that can be used on a Vue app. |
| 25 | + |
| 26 | +**Signature:** |
| 27 | +```typescript |
| 28 | +export declare function createRouter(options: RouterOptions): Router; |
| 29 | +``` |
| 30 | + |
| 31 | +### Parameters |
| 32 | + |
| 33 | +| Parameter | Type | Description | |
| 34 | +| --- | --- | --- | |
| 35 | +| options | RouterOptions | [RouterOptions](./vue-router-interface#routeroptions) | |
| 36 | + |
| 37 | +## createWebHashHistory |
| 38 | + |
| 39 | +Creates a hash history. |
| 40 | + |
| 41 | +**Signature:** |
| 42 | +```typescript |
| 43 | +export declare function createWebHashHistory(base?: string): RouterHistory; |
| 44 | +``` |
| 45 | + |
| 46 | +### Parameters |
| 47 | + |
| 48 | +| Parameter | Type | Description | |
| 49 | +| --- | --- | --- | |
| 50 | +| base | string | optional base to provide. Defaults to `___location.pathname` or `/` if at root. If there is a `base` tag in the `head`, its value will be **ignored**. | |
| 51 | + |
| 52 | +### Examples |
| 53 | + |
| 54 | + |
| 55 | +```js |
| 56 | +// at https://example.com/folder |
| 57 | +createWebHashHistory() // gives a url of `https://example.com/folder#` |
| 58 | +createWebHashHistory('/folder/') // gives a url of `https://example.com/folder/#` |
| 59 | +// if the `#` is provided in the base, it won't be added by `createWebHashHistory` |
| 60 | +createWebHashHistory('/folder/#/app/') // gives a url of `https://example.com/folder/#/app/` |
| 61 | +// you should avoid doing this because it changes the original url and breaks copying urls |
| 62 | +createWebHashHistory('/other-folder/') // gives a url of `https://example.com/other-folder/#` |
| 63 | + |
| 64 | +// at file:///usr/etc/folder/index.html |
| 65 | +// for locations with no `host`, the base is ignored |
| 66 | +createWebHashHistory('/iAmIgnored') // gives a url of `file:///usr/etc/folder/index.html#` |
| 67 | +``` |
| 68 | + |
| 69 | + |
| 70 | +## createWebHistory |
| 71 | + |
| 72 | +## isNavigationFailure |
| 73 | + |
| 74 | +## isNavigationFailure |
| 75 | + |
| 76 | +## onBeforeRouteLeave |
| 77 | + |
| 78 | +Add a navigation guard that triggers whenever the component for the current ___location is about to be left. Similar to but can be used in any component. The guard is removed when the component is unmounted. |
| 79 | + |
| 80 | +**Signature:** |
| 81 | +```typescript |
| 82 | +export declare function onBeforeRouteLeave(leaveGuard: NavigationGuard): void; |
| 83 | +``` |
| 84 | + |
| 85 | +### Parameters |
| 86 | + |
| 87 | +| Parameter | Type | Description | |
| 88 | +| --- | --- | --- | |
| 89 | +| leaveGuard | NavigationGuard | [NavigationGuard](./vue-router-interface#navigationguard) | |
| 90 | + |
| 91 | +## onBeforeRouteUpdate |
| 92 | + |
| 93 | +Add a navigation guard that triggers whenever the current ___location is about to be updated. Similar to but can be used in any component. The guard is removed when the component is unmounted. |
| 94 | + |
| 95 | +**Signature:** |
| 96 | +```typescript |
| 97 | +export declare function onBeforeRouteUpdate(updateGuard: NavigationGuard): void; |
| 98 | +``` |
| 99 | + |
| 100 | +### Parameters |
| 101 | + |
| 102 | +| Parameter | Type | Description | |
| 103 | +| --- | --- | --- | |
| 104 | +| updateGuard | NavigationGuard | [NavigationGuard](./vue-router-interface#navigationguard) | |
| 105 | + |
| 106 | +## parseQuery |
| 107 | + |
| 108 | +Transforms a queryString into a [LocationQuery](./vue-router-typealias#locationquery) object. Accept both, a version with the leading `?` and without Should work as URLSearchParams |
| 109 | + |
| 110 | +**Signature:** |
| 111 | +```typescript |
| 112 | +export declare function parseQuery(search: string): LocationQuery; |
| 113 | +``` |
| 114 | + |
| 115 | +### Parameters |
| 116 | + |
| 117 | +| Parameter | Type | Description | |
| 118 | +| --- | --- | --- | |
| 119 | +| search | string | search string to parse | |
| 120 | + |
| 121 | +### Returns |
| 122 | + |
| 123 | + a query object |
| 124 | + |
| 125 | +## stringifyQuery |
| 126 | + |
| 127 | +Stringifies a [LocationQueryRaw](./vue-router-typealias#locationqueryraw) object. Like `URLSearchParams`, it doesn't prepend a `?` |
| 128 | + |
| 129 | +**Signature:** |
| 130 | +```typescript |
| 131 | +export declare function stringifyQuery(query: LocationQueryRaw): string; |
| 132 | +``` |
| 133 | + |
| 134 | +### Parameters |
| 135 | + |
| 136 | +| Parameter | Type | Description | |
| 137 | +| --- | --- | --- | |
| 138 | +| query | LocationQueryRaw | query object to stringify | |
| 139 | + |
| 140 | +### Returns |
| 141 | + |
| 142 | + string version of the query without the leading `?` |
| 143 | + |
| 144 | +## useLink |
| 145 | + |
| 146 | +## useRoute |
| 147 | + |
| 148 | +## useRouter |
| 149 | + |
0 commit comments