:key 和 v-bind:key 在构建 v-for 循环时有什么区别?

What is the difference between :key and v-bind:key when constructing a v-for loop?

Vue 文档中有一些示例在 v-for 循环中定义键时使用 key 关键字同时使用 :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>

:key=v-bind:key=完全一样

来源:https://vuejs.org/v2/api/#v-bind

v-bind

Shorthand: :