|
|
@@ -331,8 +331,20 @@ export function processElement (element: ASTElement, options: CompilerOptions) {
|
|
|
function processKey (el) {
|
|
|
const exp = getBindingAttr(el, 'key')
|
|
|
if (exp) {
|
|
|
- if (process.env.NODE_ENV !== 'production' && el.tag === 'template') {
|
|
|
- warn(`<template> cannot be keyed. Place the key on real elements instead.`)
|
|
|
+ if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if (el.tag === 'template') {
|
|
|
+ warn(`<template> cannot be keyed. Place the key on real elements instead.`)
|
|
|
+ }
|
|
|
+ if (el.for) {
|
|
|
+ const iterator = el.iterator2 || el.iterator1
|
|
|
+ const parent = el.parent
|
|
|
+ if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
|
|
+ warn(
|
|
|
+ `Do not use v-for index as key on <transtion-group> children, ` +
|
|
|
+ `this is the same as not using keys.`
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
el.key = exp
|
|
|
}
|