Skip to content

[doc][zh-cn] keep updates #1774

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
Oct 3, 2017
Merged

[doc][zh-cn] keep updates #1774

merged 4 commits into from
Oct 3, 2017

Conversation

Jinjiang
Copy link
Member

@Jinjiang Jinjiang commented Sep 29, 2017

/ping @Justineo
Btw. make a update mark #a89d1ec

@@ -1,6 +1,6 @@
# vue-router 2
<!--email_off-->
> 注意: [email protected] 只适用于 Vue 2.x 版本。1.x 版本的文档在 [这里](https://github.com/vuejs/vue-router/tree/1.0/docs/en)。
> 注意: [email protected] 只适用于 Vue 2.x。0.7.x 版本的文档在[这里](https://github.com/vuejs/vue-router/tree/1.0/docs/zh-cn)。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问一下,为啥 0.7.x 的版本在 1.0 分支呀……

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

历史原因,1.0 没发就跳 2.0 了,大家已经接受这件事了🤣

@@ -4,7 +4,7 @@

- **导航完成之后获取**:先完成导航,然后在接下来的组件生命周期钩子中获取数据。在数据获取期间显示『加载中』之类的指示。

- **导航完成之前获取**:导航完成前,在路由的 `enter` 钩子中获取数据,在数据获取成功后执行导航。
- **导航完成之前获取**:导航完成前,在路由进入的拦截中获取数据,在数据获取成功后执行导航。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

拦截 → 守卫

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下同

结合 Vue 的 [异步组件](http://vuejs.org/guide/components.html#Async-Components) 和 Webpack 的 [code splitting feature](https://doc.webpack-china.org/guides/code-splitting-async/#require-ensure-/), 轻松实现路由组件的懒加载。

首先,可以将异步组件定义为返回一个 Promise 的工厂函数(该函数返回的Promise应该 resolve 组件本身):
结合 Vue 的[异步组件](https://cn.vuejs.org/guide/components.html#异步组件)和 Webpack 的 [code splitting feature](https://doc.webpack-china.org/guides/code-splitting-async/#require-ensure-/), 轻松实现路由组件的懒加载。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码分割功能?


首先,可以将异步组件定义为返回一个 Promise 的工厂函数 (该函数返回的Promise应该 resolve 组件本身):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise 空格

```

第二,在 webpack 2中,我们可以使用[动态 import](https://github.com/tc39/proposal-dynamic-import)语法来定义代码分块点(split point):
第二在 webpack 2 中,我们可以使用[动态 import](https://github.com/tc39/proposal-dynamic-import)语法来定义代码分块点 (split point):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webpack 2 中,Webpack 2 中,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英文版也是这样的,我同步提了一个 PR #1780

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对面的 PR 中对开头字母大写提出了异议,我稍微看了一下它的官网,似乎还真都是小写的。待我稍作确认。


配置当链接被精确匹配的时候应该激活的 CSS class。注意默认值也是可以通过路由构造函数选项 `linkExactActiveClass` 进行全局配置的。

### 将"激活时的 CSS class 应用在外层元素
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将激活 class 应用在外层元素?


配置当链接被精确匹配的时候应该激活的 CSS class。注意默认值也是可以通过路由构造函数选项 `linkExactActiveClass` 进行全局配置的。

### 将"激活时的 CSS class 应用在外层元素

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

激活时的 CSS 类名 → 激活 class?

我们好像要考虑下这个 class 要不要翻译成类名

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就 class 我觉得 OK

@@ -40,9 +40,67 @@ location / {
}
```

#### Node.js (Express)
#### 原生 Node.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他代码示例都用的单引号,这个是不是 en 里也要改一下

Copy link
Member Author

@Jinjiang Jinjiang Oct 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #1780

@@ -28,4 +28,4 @@ router.push({ name: 'user', params: { userId: 123 }})

这两种方式都会把路由导航到 `/user/123` 路径。

完整的例子请 [戳这里](https://github.com/vuejs/vue-router/blob/next/examples/named-routes/app.js).
完整的例子请[戳这里](https://github.com/vuejs/vue-router/blob/next/examples/named-routes/app.js)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“在这里”?和 named-view 里保持一致。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我在别的文档里都译成“移步这里”了

@@ -96,4 +96,4 @@ const router = new VueRouter({
})
```

提供以上案例的可运行代码,[戳这里](http://jsfiddle.net/yyx990803/L7hscd8h/).
提供以上案例的可运行代码,[戳这里](https://jsfiddle.net/yyx990803/L7hscd8h/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@Jinjiang
Copy link
Member Author

Jinjiang commented Oct 3, 2017

都处理了一遍,有劳再 review:)

@kazupon kazupon merged commit 10b7de7 into vuejs:dev Oct 3, 2017
@Jinjiang Jinjiang deleted the zh-cn branch October 3, 2017 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants