Skip to content

Commit cca778f

Browse files
authored
Update index.md
1 parent 0f7eeda commit cca778f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/api/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
15701570

15711571
- **Expects:** `string`
15721572

1573-
`key` 的特殊属性主要用在 Vu e的虚拟 DOM 算法,在新旧 nodes 对比时辨识 VNodes。如果不使用 key,Vue 会使用一种最大限度减少动态元素并且尽可能的尝试修复/再利用相同类型元素的算法。使用 key,它会基于 key 的变化重新排列元素顺序,并且会移除 key 不存在的元素
1573+
`key` 的特殊属性主要用在 Vue的虚拟DOM算法,在新旧nodes对比时辨识VNodes。如果不使用key,Vue会使用一种最大限度减少动态元素并且尽可能的尝试修复/再利用相同类型元素的算法。使用key,它会基于key的变化重新排列元素顺序,并且会移除key不存在的元素
15741574

15751575
相同公共父元素的子元素必须有**独特的key**。重复的key会造成渲染错误。
15761576

@@ -1595,13 +1595,13 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
15951595
</transition>
15961596
```
15971597

1598-
When `text` changes, the `<span>` will always be replaced instead of patched, so a transition will be triggered.
1598+
`text` 发生改变时,`<span>` 会随时被更新,因此会触发过度。
15991599

16001600
### ref
16011601

16021602
- **Expects:** `string`
16031603

1604-
`ref` is used to register a reference to an element or a child component. The reference will be registered under the parent component's `$refs` object. If used on a plain DOM element, the reference will be that element; if used on a child component, the reference will be component instance:
1604+
`ref` 被用来给元素或子组件注册引用信息。引用信息会根据父组件的 `$refs` 对象进行注册。如果在普通的DOM元素上使用,引用信息就是元素; 如果用在子组件上,引用信息就是组件实例:
16051605

16061606
``` html
16071607
<!-- vm.$refs.p will the DOM node -->
@@ -1611,19 +1611,19 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
16111611
<child-comp ref="child"></child-comp>
16121612
```
16131613

1614-
When used on elements/components with `v-for`, the registered reference will be an Array containing DOM nodes or component instances.
1614+
`v-for` 用于元素或组件的时候,引用信息将是包含DOM节点或组件实例数组。
16151615

1616-
An important note about the ref registration timing: because the refs themselves are created as a result of the render function, you cannot access them on the initial render - they don't exist yet! `$refs` is also non-reactive, therefore you should not attempt to use it in templates for data-binding.
1616+
关于ref注册时间的重要说明: 因为ref本身是作为渲染结果被创建的,在初始渲染的时候你不能访问它们 - 它们还不存在!`$refs` 也不能使用,因此你不应该试图用它在模版中做数据绑定。
16171617

16181618
- **See also:** [Child Component Refs](/guide/components.html#Child-Component-Refs)
16191619

16201620
### slot
16211621

16221622
- **Expects:** `string`
16231623

1624-
Used on content inserted into child components to indicate which named slot the content belongs to.
1624+
用于标记往哪个slot中插入子组件内容。
16251625

1626-
For detailed usage, see the guide section linked below.
1626+
详细用法,请参考下面指南部分的链接。
16271627

16281628
- **See also:** [Named Slots](/guide/components.html#Named-Slots)
16291629

0 commit comments

Comments
 (0)