【发布时间】:2019-08-01 23:05:24
【问题描述】:
在 Vue 文档中有使用 key 关键字的示例,在 v-for 循环中定义键时同时使用 :key= 和 v-bind:key=。一个只是另一个的语法糖,还是他们做不同的事情?
Examples from the docs using both types:
:key
<my-component v-for="item in items" :key="item.id"></my-component>
v-bind:key
<my-component
v-for="(item, index) in items"
v-bind:item="item"
v-bind:index="index"
v-bind:key="item.id"
></my-component>
【问题讨论】: