Skip to content

Commit 92395d4

Browse files
committed
docs: addRoute, getRoutes
1 parent 53b68dd commit 92395d4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: docs/api/README.md

+32
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ Reverse URL resolving. Given location in form same as used in `<router-link/>`.
420420
421421
### router.addRoutes
422422
423+
_DEPRECATED_: use [`route.addRoute()`](#router-addroute) instead.
424+
423425
Signature:
424426
425427
```js
@@ -428,6 +430,36 @@ router.addRoutes(routes: Array<RouteConfig>)
428430
429431
Dynamically add more routes to the router. The argument must be an Array using the same route config format with the `routes` constructor option.
430432
433+
### router.addRoute
434+
435+
Add a new route to the router. If the route has a `name` and there is already an existing one with the same one, it overwrites it.
436+
437+
Signature:
438+
439+
```ts
440+
addRoute(route: RouteConfig): () => void
441+
```
442+
443+
### router.addRoute
444+
445+
Add a new route record as the child of an existing route. If the route has a `name` and there is already an existing one with the same one, it overwrites it.
446+
447+
Signature:
448+
449+
```ts
450+
addRoute(parentName: string, route: RouteConfig): () => void
451+
```
452+
453+
### router.getRoutes
454+
455+
Get the list of all the active route records. **Note only documented properties are considered Public API**, avoid using any other propery e.g. `regex` as it doesn't exist on Vue Router 4.
456+
457+
Signature:
458+
459+
```ts
460+
getRoutes(): RouteRecord[]
461+
```
462+
431463
### router.onReady
432464
433465
Signature:

0 commit comments

Comments
 (0)