Skip to content

Commit 92da428

Browse files
authored
Merge pull request #58 from 70data/2.0-cn
更新 15 16 部分13
2 parents 5f60a3e + 5efd111 commit 92da428

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/api/index.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,30 +1564,30 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
15641564
- [Data Binding Syntax - interpolations](/guide/syntax.html#Text)
15651565
- [Components - Cheap Static Components with v-once](/guide/components.html#Cheap-Static-Components-with-v-once)
15661566

1567-
## Special Attributes
1567+
## 特殊元素
15681568

15691569
### key
15701570

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

1573-
The `key` special attribute is primarily used as a hint for Vue's virtual DOM algorithm to identify VNodes when diffing the new list of nodes against the old list. Without keys, Vue uses an algorithm that minimizes element movement and tries to patch/reuse elements of the same type in-place as much as possible. With keys, it will reorder elements based on the order change of keys, and elements with keys that are no longer present will always be removed/destroyed.
1573+
`key`的特殊属性主要用在Vue的虚拟DOM算法,在新旧nodes对比时辨识VNodes。如果不使用key,Vue会使用一种最大限度减少动态元素并且尽可能的尝试修复/再利用相同类型元素的算法。使用key,它会基于key的变化重新排列元素顺序,并且会移除keys不存在的元素。
15741574

1575-
Children of the same common parent must have **unique keys**. Duplicate keys will cause render errors.
1575+
相同公共父元素的子元素必须有**独特的key**。重复的key会造成渲染错误。
15761576

1577-
The most common use case is combined with `v-for`:
1577+
最常见的用例是结合`v-for`:
15781578

15791579
``` html
15801580
<ul>
15811581
<li v-for="item in items" :key="item.id">...</li>
15821582
</ul>
15831583
```
15841584

1585-
It can also be used to force replacement of an element/component instead of reusing it. This can be useful when you want to:
1585+
它也可以用于强制替换元素/组件而不是重复使用它。当你遇到如下场景时它可能会很有用:
15861586

1587-
- Properly trigger lifecycle hooks of a component
1588-
- Trigger transitions
1587+
- 正确的触发组件的生命周期hooks
1588+
- 触发转换
15891589

1590-
For example:
1590+
例如:
15911591

15921592
``` html
15931593
<transition>
@@ -1788,10 +1788,10 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
17881788

17891789
- **See also:** [Content Distribution with Slots](/guide/components.html#Content-Distribution-with-Slots)
17901790

1791-
## VNode Interface
1791+
## VNode接口
17921792

1793-
- Please refer to the [VNode class declaration](https://github.com/vuejs/vue/blob/dev/src/core/vdom/vnode.js).
1793+
- 请参考[VNode class declaration](https://github.com/vuejs/vue/blob/dev/src/core/vdom/vnode.js).
17941794

1795-
## Server-Side Rendering
1795+
## 服务端渲染
17961796

1797-
- Please refer to the [vue-server-renderer package documentation](https://github.com/vuejs/vue/tree/dev/packages/vue-server-renderer).
1797+
- 请参考[vue-server-renderer package documentation](https://github.com/vuejs/vue/tree/dev/packages/vue-server-renderer).

0 commit comments

Comments
 (0)