V-For Key (ARCH3324)
Ce contenu n’est pas encore disponible dans votre langue.
Key typescript.vue.v-for-key · Severity warning · Category quality
Vue: flags a v-for with no :key. Vue then patches list nodes by position, so DOM state (focus, input text, transitions) stays with the slot instead of the item.
Incorrect
Section titled “Incorrect”<li v-for="item in items">{{ item.name }}</li>Correct
Section titled “Correct”<li v-for="item in items" :key="item.id">{{ item.name }}</li>