Skip to content

Commit cf871b3

Browse files
committed
refactor: review [skip ci]
1 parent cba9650 commit cf871b3

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

Diff for: types/router.d.ts

+14-26
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import Vue, { ComponentOptions, PluginFunction, AsyncComponent, VNode } from 'vue'
22

3-
type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent | {}
3+
type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent
44
type Dictionary<T> = { [key: string]: T }
55
type ErrorHandler = (err: Error) => void
66

7-
/**
8-
* * `"hash"`: uses the URL hash for routing. Works in all Vue-supported browsers, including those that do not support HTML5 History API.
9-
* * `"history"`: requires HTML5 History API and server config. See HTML5 History Mode.
10-
* * `"abstract"`: works in all JavaScript environments, e.g. server-side with Node.js. **The router will automatically be forced into this mode if no browser API is present.**
11-
*/
127
export type RouterMode = 'hash' | 'history' | 'abstract'
138
export type RawLocation = string | Location
149
export type RedirectOption = RawLocation | ((to: Route) => RawLocation)
@@ -34,14 +29,7 @@ export declare class VueRouter {
3429
*/
3530
options: RouterOptions
3631
/**
37-
* Configure the router mode.
38-
*
39-
* default: `"hash"` (in browser) | `"abstract"` (in Node.js)
40-
*
41-
* available values: `"hash" | "history" | "abstract"`
42-
* * `"hash"`: uses the URL hash for routing. Works in all Vue-supported browsers, including those that do not support HTML5 History API.
43-
* * `"history"`: requires HTML5 History API and server config. See HTML5 History Mode.
44-
* * `"abstract"`: works in all JavaScript environments, e.g. server-side with Node.js. **The router will automatically be forced into this mode if no browser API is present.**
32+
* Configured mode when creating the Router instance.
4533
*/
4634
mode: RouterMode
4735
/**
@@ -102,7 +90,7 @@ export declare class VueRouter {
10290
push(to: RawLocation): Promise<Route>
10391
/**
10492
* Programmatically navigate to a new URL by pushing an entry in the history stack.
105-
*
93+
*
10694
* @param to Route location to navigate to
10795
* @param onComplete Navigation success callback
10896
* @param onAbort Navigation aborted callback
@@ -122,7 +110,7 @@ export declare class VueRouter {
122110
/**
123111
* Programmatically navigate to a new URL by replacing the current entry in
124112
* the history stack.
125-
*
113+
*
126114
* @param to Route location to navigate to
127115
* @param onComplete Navigation success callback
128116
* @param onAbort Navigation aborted callback
@@ -154,7 +142,7 @@ export declare class VueRouter {
154142
getMatchedComponents(to?: RawLocation | Route): Component[]
155143
/**
156144
* This method queues a callback to be called when the router has completed the initial navigation, which means it has resolved all async enter hooks and async components that are associated with the initial route.
157-
*
145+
*
158146
* This is useful in server-side rendering to ensure consistent output on both the server and the client.
159147
* @param cb onReady callback.
160148
* @param errorCb errorCb will be called when the initial route resolution runs into an error (e.g. failed to resolve an async component).
@@ -187,12 +175,12 @@ export declare class VueRouter {
187175
*/
188176
addRoute(route: RouteConfig): void
189177
/**
190-
* Get the list of all the active route records.
178+
* Get the list of all the active route records.
191179
*/
192180
getRoutes(): RouteRecordPublic[]
193181

194182
/**
195-
*
183+
*
196184
* @param to Route location
197185
* @param current current is the current Route by default (most of the time you don't need to change this)
198186
* @param append allows you to append the path to the `current` route (as with `router-link`)
@@ -230,7 +218,7 @@ export declare class VueRouter {
230218

231219
/**
232220
* Enumeration with all possible types for navigation failures.
233-
*
221+
*
234222
* Can be passed to {@link isNavigationFailure} to check for specific failures.
235223
*/
236224
export enum NavigationFailureType {
@@ -289,13 +277,13 @@ export interface RouterOptions {
289277
routes?: RouteConfig[]
290278
/**
291279
* Configure the router mode.
292-
*
280+
*
293281
* default: `"hash"` (in browser) | `"abstract"` (in Node.js)
294-
*
282+
*
295283
* available values: `"hash" | "history" | "abstract"`
296-
* * `"hash"`: uses the URL hash for routing. Works in all Vue-supported browsers, including those that do not support HTML5 History API.
297-
* * `"history"`: requires HTML5 History API and server config. See HTML5 History Mode.
298-
* * `"abstract"`: works in all JavaScript environments, e.g. server-side with Node.js. **The router will automatically be forced into this mode if no browser API is present.**
284+
* - `"hash"`: uses the URL hash for routing. Works in all Vue-supported browsers, including those that do not support HTML5 History API.
285+
* - `"history"`: requires HTML5 History API and server config. See HTML5 History Mode.
286+
* - `"abstract"`: works in all JavaScript environments, e.g. server-side with Node.js. **The router will automatically be forced into this mode if no browser API is present.**
299287
*/
300288
mode?: RouterMode
301289
fallback?: boolean
@@ -318,7 +306,7 @@ export interface RouterOptions {
318306
stringifyQuery?: (query: Object) => string
319307
/**
320308
* Function to control scrolling when navigating between pages. Can return a Promise to delay scrolling.
321-
*
309+
*
322310
* For more details see {@link Scroll Behavior}.
323311
*/
324312
scrollBehavior?: (

0 commit comments

Comments
 (0)