Skip to content

Synced recent updates to #dee0bfd #566

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 3 commits into from
Oct 18, 2017
Merged

Synced recent updates to #dee0bfd #566

merged 3 commits into from
Oct 18, 2017

Conversation

Jinjiang
Copy link
Member

@Jinjiang Jinjiang requested a review from Justineo October 16, 2017 15:04
'my-custom-web-component',
'another-web-component',
// 用一个 `RegExp` 忽略所有“ion-”开头的元素
// 2.5+ only
Copy link
Member

Choose a reason for hiding this comment

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

仅在 2.5+ 支持?

@@ -602,6 +607,11 @@ type: api
c: {
handler: function (val, oldVal) { /* ... */ },
deep: true
},
// 该回调将会在监听开始之后被立即调用
Copy link
Member

Choose a reason for hiding this comment

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

侦听?


- **详细**:

当捕获一个来自子孙组件的错误时被调用。此钩子会收到三个参数:错误本身、发生错误的组件实例以及一个包含错误来源信息的字符串。此钩子可以返回 `false` 以阻止该错误继续向上传播。
Copy link
Member

Choose a reason for hiding this comment

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

错误本身 → 错误对象?


当捕获一个来自子孙组件的错误时被调用。此钩子会收到三个参数:错误本身、发生错误的组件实例以及一个包含错误来源信息的字符串。此钩子可以返回 `false` 以阻止该错误继续向上传播。

<p class="tip">你可以在此钩子中修改组件的状态。因此在你的模板或渲染函数中设置其它内容的短路条件非常重要,它可以防止当一个错误被捕获时该组件抛出一个无限的渲染循环。</p>
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.

“……组件进入一个无限的渲染循环”?


- 默认情况下,如果全局的 `config.errorHandler` 被定义,所有的错误仍会发送它,因此这些错误仍让会向单一的分析服务的地方进行汇报。

- 如果一个组件的继承或父级从属链路中存在多个 `errorCaptured` 钩子,则它们将会被相同的错误同时唤起。
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 Author

Choose a reason for hiding this comment

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

恩,我觉得可以先在原文讨论,我这暂时改成“逐个唤起”

在你花一些时日了解这些资源之后,我们建议你参考 [webpack-simple](https://github.com/vuejs-templates/webpack-simple)。只要遵循指示,你就能很快地运行一个用到 `.vue` 组件,ES2015 和 热重载 (hot-reloading) 的 Vue 项目!

这个模板使用 [Webpack](https://webpack.github.io/),一个能将多个模块打包成最终应用的模块打包工具。想学习更多 Webpack 的知识,请移步[它们的官方文档](https://webpack.js.org/configuration/)以及 [Webpack Academy](https://webpack.academy/p/the-core-concepts)。
在你花一些时日了解这些资源之后,我们建议你参考 [webpack](https://github.com/vuejs-templates/webpack)。只要遵循指示,你就能很快地运行一个用到 `.vue` 组件,ES2015 和 热重载 (hot-reloading) 的 Vue 项目!
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.

After you've taken a day to dive into these resources

这里“take a day”译为“一些时日”好像不是很准确?“一些时日”感觉是比较长的一段时间。

还有一处:“……建议你参考 webpack 模板。”

Copy link
Member Author

Choose a reason for hiding this comment

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

就直译为“一天时间”吧
OK,这里其实我没额外翻译,原文只是调整了语句的顺序而已。已修正。


在 Webpack 中,每个模块被打包到 bundle 之前都由一个相应的 "loader" 来转换,Vue 也提供 [vue-loader](https://github.com/vuejs/vue-loader) 插件来执行 `.vue` 单文件组件 的转换。这个 [webpack-simple](https://github.com/vuejs-templates/webpack-simple) 模板已经为你准备好了所有的东西,但是如果你想了解更多关于 `.vue` 组件和 Webpack 如何一起运转的信息,你可以阅读 [vue-loader 的文档](https://vue-loader.vuejs.org)
想学习更多 webpack 的知识,请移步[它们的官方文档](https://webpack.js.org/configuration/)以及 [webpack learning academy](https://webpack.academy/p/the-core-concepts)。在 webpack 中,每个模块被打包到 bundle 之前都由一个相应的 "loader" 来转换,Vue 也提供 [vue-loader](https://github.com/vuejs/vue-loader) 插件来执行 `.vue` 单文件组件 的转换。
Copy link
Member

Choose a reason for hiding this comment

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

"loader" → “loader”

@@ -858,6 +894,8 @@ PascalCase 相比 kebab-case 有一些优势:

不幸的是,由于 HTML 是大小写不敏感的,在 DOM 模板中必须仍使用 kebab-case。

还要注意的是,如果你已经打算深度投资 kebab-case,和 HTML 约定保持一致,且能够横跨你的所有项目使用相同的大小写规则,那么上述的优势就没那么重要了。在这些情况下,**在所有的地方都使用 kebab-case 同样是可以接受的。**
Copy link
Member

Choose a reason for hiding this comment

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

Also note that if you've already invested heavily in kebab-case, consistency with HTML conventions and being able to use the same casing across all your projects may be more important than the advantages listed above.

“还请注意,如果你已经是 kebab-case 的重度用户,那么与 HTML 保持一致的命名约定且在多个项目中保持相同的大小写规则就可能比上述优势更为重要了。”

@Jinjiang Jinjiang merged commit cb985a9 into master Oct 18, 2017
@Jinjiang Jinjiang deleted the sync-dee0bfd branch October 18, 2017 08:34
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.

2 participants