Skip to content

[docs][zh-cn] synced udpates and some typos #2087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/zh-cn/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- [编程式导航](essentials/navigation.md)
- [命名路由](essentials/named-routes.md)
- [命名视图](essentials/named-views.md)
- [重定向 和 别名](essentials/redirect-and-alias.md)
- [重定向和别名](essentials/redirect-and-alias.md)
- [向路由组件传递 props](essentials/passing-props.md)
- [HTML5 History 模式](essentials/history-mode.md)
- 进阶
Expand Down
26 changes: 15 additions & 11 deletions docs/zh-cn/api/route-object.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 路由信息对象

一个 **route object(路由信息对象)** 表示当前激活的路由的状态信息,包含了当前 URL 解析得到的信息,还有 URL 匹配到的 **route records(路由记录)**。
一个**路由对象 (route object)** 表示当前激活的路由的状态信息,包含了当前 URL 解析得到的信息,还有 URL 匹配到的**路由记录 (route records)**。

route object 是 immutable(不可变) 的,每次成功的导航后都会产生一个新的对象。
路由对象是不可变 (immutable) 的,每次成功的导航后都会产生一个新的对象。

route object 出现在多个地方:
路由对象出现在多个地方:

- 在组件内,即 `this.$route`

Expand All @@ -16,7 +16,7 @@ route object 出现在多个地方:

``` js
router.beforeEach((to, from, next) => {
// to 和 from 都是 路由信息对象
// `to``from` 都是路由对象
})
```

Expand All @@ -25,7 +25,7 @@ route object 出现在多个地方:
``` js
const router = new VueRouter({
scrollBehavior (to, from, savedPosition) {
// to 和 from 都是 路由信息对象
     // `to``from` 都是路由对象
}
})
```
Expand All @@ -42,7 +42,7 @@ route object 出现在多个地方:

- 类型: `Object`

一个 key/value 对象,包含了 动态片段 和 全匹配片段,如果没有路由参数,就是一个空对象。
一个 key/value 对象,包含了动态片段和全匹配片段,如果没有路由参数,就是一个空对象。

- **$route.query**

Expand All @@ -66,24 +66,28 @@ route object 出现在多个地方:

- 类型: `Array<RouteRecord>`

一个数组,包含当前路由的所有嵌套路径片段的 **路由记录** 。路由记录就是 `routes` 配置数组中的对象副本还有在 `children` 数组
一个数组,包含当前路由的所有嵌套路径片段的**路由记录** 。路由记录就是 `routes` 配置数组中的对象副本 (还有在 `children` 数组)

``` js
const router = new VueRouter({
routes: [
// 下面的对象就是 route record
// 下面的对象就是路由记录
{ path: '/foo', component: Foo,
children: [
// 这也是个 route record
// 这也是个路由记录
{ path: 'bar', component: Bar }
]
}
]
})
```

当 URL 为 `/foo/bar`,`$route.matched` 将会是一个包含从上到下的所有对象(副本)
当 URL 为 `/foo/bar`,`$route.matched` 将会是一个包含从上到下的所有对象 (副本)

- **$route.name**

当前路由的名称,如果有的话。(查看 [命名路由](../essentials/named-routes.md))
当前路由的名称,如果有的话。(查看[命名路由](../essentials/named-routes.md))

- **$route.redirectedFrom**

如果存在重定向,即为重定向来源的路由的名字。(参阅[重定向和别名](../essentials/redirect-and-alias.md))
2 changes: 1 addition & 1 deletion docs/zh-cn/essentials/redirect-and-alias.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 重定向 和 别名
# 重定向和别名

### 重定向

Expand Down