File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1570,24 +1570,24 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
1570
1570
1571
1571
- ** Expects:** ` string `
1572
1572
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不存在的元素 。
1574
1574
1575
- Children of the same common parent must have ** unique keys ** . Duplicate keys will cause render errors.
1575
+ 相同公共父元素的子元素必须有 ** 独特的key ** 。重复的key会造成渲染错误。
1576
1576
1577
- The most common use case is combined with ` v-for ` :
1577
+ 最常见的用例是结合 ` v-for ` :
1578
1578
1579
1579
``` html
1580
1580
<ul >
1581
1581
<li v-for =" item in items" :key =" item.id" >...</li >
1582
1582
</ul >
1583
1583
```
1584
1584
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
+ 它也可以用于强制替换元素/组件而不是重复使用它。它可以用来做如下你想做的 :
1586
1586
1587
- - Properly trigger lifecycle hooks of a component
1588
- - Trigger transitions
1587
+ - 正确的触发组件的生命周期hooks
1588
+ - 触发转换
1589
1589
1590
- For example :
1590
+ 例如 :
1591
1591
1592
1592
``` html
1593
1593
<transition >
You can’t perform that action at this time.
0 commit comments