Skip to content

Commit 9887a1d

Browse files
committed
docs: update router.go()
1 parent bdb3707 commit 9887a1d

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

docs/en/api/go.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ Programatically navigate to a new route.
44

55
### Arguments
66

7-
- `path: String`
7+
- `path: String | Object`
88

9-
The path must be a plain path (i.e. no dynamic segments or star segments). The path doesn't start with `/`, it will be resolved relative to the current active path.
9+
The path can be either a String or an Object.
10+
11+
If a String, the path must be a plain path (i.e. no dynamic segments or star segments). The path doesn't start with `/`, it will be resolved relative to the current active path.
12+
13+
If an Object, it can either be in the form of:
14+
15+
``` js
16+
{ path: '...' }
17+
```
18+
19+
Or:
20+
21+
``` js
22+
{
23+
name: '...',
24+
// params and query are optional
25+
params: { ... },
26+
query: { ... }
27+
}
28+
```
29+
30+
For details about the `name` Object format, see [Named Routes](../named.md).

docs/zh-cn/api/go.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@
44

55
### 参数
66

7-
- `path: String`
7+
- `path: String | Object`
88

9-
此路径为一个普通路径(也就是说没有动态片段或者全匹配片段)。路径不能以 `/` 开头,会以相对于当前路径的方式进行解析。
9+
`path` 可以是一个字符串,或是包含跳转信息的对象。
10+
11+
当是字符串时,该路径必须为一个普通路径(也就是说没有动态片段或者全匹配片段)。路径若不是以 `/` 开头的绝对路径,会以相对于当前路径的方式进行解析。
12+
13+
当是对象时,可以是如下的格式:
14+
15+
``` js
16+
{ path: '...' }
17+
```
18+
19+
或是:
20+
21+
``` js
22+
{
23+
name: '...',
24+
// params 和 query 可选
25+
params: { ... },
26+
query: { ... }
27+
}
28+
```
29+
30+
关于包含 `name` 的路径对象,参见[具名路径](../named.md).

0 commit comments

Comments
 (0)