-
Notifications
You must be signed in to change notification settings - Fork 3.4k
translated components.md #714
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
Conversation
src/v2/guide/components.md
Outdated
' | ||
}) | ||
``` | ||
如果你感觉已经掌握了这些知识,我们推荐你再回来把完整的组件指南,包括侧边栏中组件深入章节的所有页面读完, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
英文版放了一个 components-dynamic-async.html
的链接,不是特别理解,所以暂时没有放上去,稍微改了改。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,
→ 。
src/v2/guide/components.md
Outdated
|
||
问题解决了! | ||
到这里,你需要了解的解析 DOM 模板时的注意事项——实际上也是 Vue 的全部_必要内容_,大概就是这些了。恭喜你!接下来还有很多东西要去学习,不过首先,我们推荐你先休息一下,试用一下 Vue,自己随意做些好玩的东西。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
英文版提到的是“dynamic components”,不确定是不是复制粘贴错了,我暂时改成了“解析 DOM 模板时的注意事项”
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
也有可能最后一个大标题是后补的……
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原文肯定是错了……
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
→ *
?
src/v2/guide/components.md
Outdated
}) | ||
``` | ||
|
||
要注册一个全局组件,可以使用 `Vue.component(tagName, options)`。例如: | ||
组件是可复用的 Vue 实例,且带有一个名字:在这个例子中是 `<button-counter>`。我们在一个通过 `new Vue` 创建的 Vue 根实例中可以作为一个自定义元素来使用这个组件: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“我们可以在一个通过 new Vue
创建的 Vue 根实例中,把这个组件作为自定义元素来使用:”?
src/v2/guide/components.md
Outdated
el: '#example' | ||
}) | ||
``` | ||
因为组件是可复用的 Vue 实例,它们接收和 `new Vue` 相同的选项,例如 `data`、`computed`、`watch`、`methods` 以及生命周期钩子等。也有少数 `el` 这样的根特有的例外选项。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为……所以它们与 new Vue
接收相同的选项?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
仅有的例外是如 el
这样根实例特有的选项?
src/v2/guide/components.md
Outdated
|
||
渲染为: | ||
## 复用组件 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉「组件(的)复用」这个结构更适合做标题(需要讨论)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
组件的复用我觉得可接受
src/v2/guide/components.md
Outdated
``` html | ||
<div id="example"> | ||
<div>A custom component!</div> | ||
组件是你想复用多少次就可以复用多少次的: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你可以将组件进行任意次数的复用?
src/v2/guide/components.md
Outdated
``` | ||
|
||
这种封装也适用于其它可注册的 Vue 功能,比如指令。 | ||
如果 Vue 没有这条规则,点击一个按钮就可能会像如下代码一样影响到_其它所有实例_: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
→ *
?
src/v2/guide/components.md
Outdated
} | ||
}, | ||
}) | ||
这个自定义组件 `<blog-post-row>` 会被看作无效内容,并导致最终渲染结果出错。幸好这个特殊的 `is` 特性给了我们一个变通的办法: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
被作为无效的内容提升到外部
src/v2/guide/components.md
Outdated
``` | ||
|
||
你可以在工厂函数中返回一个 `Promise`,所以当使用 webpack 2 + ES2015 的语法时可以这样: | ||
我们应该注意到**如果我们从以下来源使用模板的话,这条限制是_不存在_的**: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要注意的是……
src/v2/guide/components.md
Outdated
|
||
问题解决了! | ||
到这里,你需要了解的解析 DOM 模板时的注意事项——实际上也是 Vue 的全部_必要内容_,大概就是这些了。恭喜你!接下来还有很多东西要去学习,不过首先,我们推荐你先休息一下,试用一下 Vue,自己随意做些好玩的东西。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原文肯定是错了……
src/v2/guide/components.md
Outdated
|
||
问题解决了! | ||
到这里,你需要了解的解析 DOM 模板时的注意事项——实际上也是 Vue 的全部_必要内容_,大概就是这些了。恭喜你!接下来还有很多东西要去学习,不过首先,我们推荐你先休息一下,试用一下 Vue,自己随意做些好玩的东西。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
→ *
?
src/v2/guide/components.md
Outdated
' | ||
}) | ||
``` | ||
如果你感觉已经掌握了这些知识,我们推荐你再回来把完整的组件指南,包括侧边栏中组件深入章节的所有页面读完, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,
→ 。
新的 components.md 页面 (基础篇)
英文版可以参考第一次提交
谢谢