Skip to content

Commit e295bae

Browse files
authored
Update index.md
1 parent 8514d90 commit e295bae

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,24 +1570,24 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
15701570

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

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

0 commit comments

Comments
 (0)