-
Notifications
You must be signed in to change notification settings - Fork 3.4k
translated components-custom-events.md #704
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
|
||
这样会把 `doc` 对象中的每一个属性 (如 `title`) 都作为一个独立的 prop 传进去,然后各自添加用作更新的 `v-on` 监听器。 | ||
|
||
<p class="tip">请将 <code>v-bind.sync</code> 用在一个字面量的对象上,例如 <code>v-bind.sync="{ title: doc.title }"</code>,因为在解析一个像这样的复杂表达式的时候,有很多边缘情况需要考虑。</p> |
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.
https://cn.vuejs.org/v2/guide/components.html#sync-%E4%BF%AE%E9%A5%B0%E7%AC%A6
之前的文档写的是支持字面量对象,新版不支持。
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.
vuejs/v2.vuejs.org@5adbc5f
原先是这句:will not work,最新的去掉了。到底是支持还是不支持?
Using v-bind.sync
with a literal object, such as in v-bind.sync="{ title: doc.title }"
, will not work. If you want to include multiple, unrelated data properties in the same v-bind.sync
, we recommend creating a computed property that returns an object.
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.
最新的原文显然是读不通的,可能就像 @dear-lizhihua 所言少了“will not work”。感觉需要和 Chris 确认一下。
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.
现在 vuejs.org 的网站上和源代码的 master 分支里不都有“will not work”吗?
https://vuejs.org/v2/guide/components-custom-events.html
https://github.com/vuejs/vuejs.org/blob/master/src/v2/guide/components-custom-events.md
应该是我之前 fork 出来的某个版本没有吧?
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.
vuejs/v2.vuejs.org#1572
10小时前刚合并进去的,我们讨论的是19小时前的版本
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.
got,那我就保持现状了
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.
(当然其余的部分仍然需要 review,所以现在不会立刻 merge)
|
||
> 2.2.0+ 新增 | ||
|
||
一个组件上的 `v-model` 默认会利用名为 `value` 的 prop 和名为 `input` 的事件,但是像单选框、复选框等一些输入类型可能会将 `value` 特性用于[不同的目的](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#Value)。`model` 选项可以用来避免这样的冲突: |
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.
input types 这个 input 应该是输入组件的意思,合起来:单选框、复选框等类型的输入组件?
</label> | ||
``` | ||
|
||
这时,父级的 `.native` 监听器将会被默默的破坏。它不会产生任何报错,但是 `onFocus` 处理函数不会如你预期的被调用。 |
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.
如你预期地
<text-document v-bind.sync="doc"></text-document> | ||
``` | ||
|
||
这样会把 `doc` 对象中的每一个属性 (如 `title`) 都作为一个独立的 prop 传进去,然后各自添加用作更新的 `v-on` 监听器。 |
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.
用于更新
No description provided.