Skip to content

Commit 86fb1c6

Browse files
committed
docs for 2.1.0
1 parent dfd5c26 commit 86fb1c6

File tree

4 files changed

+51
-7
lines changed

4 files changed

+51
-7
lines changed

docs/en/api/router-instance.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,20 @@
3636

3737
Programmatically navigate to a new URL. See [Programmatic Navigation](../essentials/navigation.md).
3838

39-
- **router.getMatchedComponents()**
39+
- **router.getMatchedComponents(location?)**
40+
41+
Returns an Array of the components (definition/constructor, not instances) matched by the provided location or the current route. This is mostly used during server-side rendering to perform data prefetching.
4042

41-
Returns an Array of the components (definition/constructor, not instances) matched by the current route. This is mostly used during server-side rendering to perform data prefetching.
42-
4343
- **router.resolve(location, current?, append?)**
4444

45-
Reverse URL resolving. Given location in form same as used in `<router-link/>`, returns object with string property `href`.
45+
> 2.1.0+
46+
47+
Reverse URL resolving. Given location in form same as used in `<router-link/>`, returns object with the following resolved properties:
48+
49+
``` js
50+
{
51+
normalizedTo: Location;
52+
resolved: Route;
53+
href: string;
54+
}
55+
```

docs/en/api/router-link.md

+10
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@
105105

106106
Checkout more examples explaining active link class [live](http://jsfiddle.net/fnlCtrl/dokbyypq/).
107107

108+
- **events**
109+
110+
> 2.1.0+
111+
112+
- type: `string | Array<string>`
113+
114+
- default: `'click'`
115+
116+
Specify the event(s) that can trigger the link navigation.
117+
108118
### Applying Active Class to Outer Element
109119

110120
Sometimes we may want the active class to be applied to an outer element rather than the `<a>` tag itself, in that case, you can render that outer element using `<router-link>` and wrap the raw `<a>` tag inside:

docs/zh-cn/api/router-instance.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@
3636

3737
动态的导航到一个新 url。参考 [编程式导航](../essentials/navigation.md).
3838

39-
- **router.getMatchedComponents()**
39+
- **router.getMatchedComponents(location?)**
4040

41-
返回当前路由匹配的组件数组(是数组的定义/构造类,不是实例)。通常在服务端渲染的数据预加载时时候。
41+
返回目标位置或是当前路由匹配的组件数组(是数组的定义/构造类,不是实例)。通常在服务端渲染的数据预加载时时候。
42+
43+
- **router.resolve(location, current?, append?)**
44+
45+
> 2.1.0+
46+
47+
解析目标位置(格式和 `<router-link>``to` prop 一样),返回包含如下属性的对象:
48+
49+
``` js
50+
{
51+
normalizedTo: Location;
52+
resolved: Route;
53+
href: string;
54+
}
55+
```

docs/zh-cn/api/router-link.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
- 默认值: `"a"`
7676

7777
有时候想要 `<router-link>` 渲染成某种标签,例如 `<li>`
78-
于是我们使用 `tag` prop 类指定何种标签,同样它还是会监听点击,触发导航。
78+
于是我们使用 `tag` prop 类指定何种标签,同样它还是会监听点击,触发导航。
7979

8080
``` html
8181
<router-link to="/foo" tag="li">foo</router-link>
@@ -111,6 +111,16 @@
111111

112112
查看更多关于激活链接类名的例子 [可运行](http://jsfiddle.net/fnlCtrl/dokbyypq/).
113113

114+
- **events**
115+
116+
> 2.1.0+
117+
118+
- 类型: `string | Array<string>`
119+
120+
- 默认值: `'click'`
121+
122+
声明可以用来触发导航的事件。可以是一个字符串或是一个包含字符串的数组。
123+
114124
### 将"激活时的CSS类名"应用在外层元素
115125

116126
有时候我们要让 "激活时的CSS类名" 应用在外层元素,而不是 `<a>` 标签本身,那么可以用 `<router-link>` 渲染外层元素,包裹着内层的原生 `<a>` 标签:

0 commit comments

Comments
 (0)