dx(compiler-core): warn on <template v-for> key misplacement
Note: the behavior is different from Vue 2. `<template v-for>` are compiled into an array of Fragment vnodes so the key should be placed the `<template>` for v-for to use it for diffing.
This commit is contained in:
@@ -67,6 +67,7 @@ export const enum ErrorCodes {
|
||||
X_V_ELSE_NO_ADJACENT_IF,
|
||||
X_V_FOR_NO_EXPRESSION,
|
||||
X_V_FOR_MALFORMED_EXPRESSION,
|
||||
X_V_FOR_TEMPLATE_KEY_PLACEMENT,
|
||||
X_V_BIND_NO_EXPRESSION,
|
||||
X_V_ON_NO_EXPRESSION,
|
||||
X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET,
|
||||
@@ -140,6 +141,7 @@ export const errorMessages: { [code: number]: string } = {
|
||||
[ErrorCodes.X_V_ELSE_NO_ADJACENT_IF]: `v-else/v-else-if has no adjacent v-if.`,
|
||||
[ErrorCodes.X_V_FOR_NO_EXPRESSION]: `v-for is missing expression.`,
|
||||
[ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION]: `v-for has invalid expression.`,
|
||||
[ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT]: `<template v-for> key should be placed on the <template> tag.`,
|
||||
[ErrorCodes.X_V_BIND_NO_EXPRESSION]: `v-bind is missing expression.`,
|
||||
[ErrorCodes.X_V_ON_NO_EXPRESSION]: `v-on is missing expression.`,
|
||||
[ErrorCodes.X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET]: `Unexpected custom directive on <slot> outlet.`,
|
||||
|
||||
Reference in New Issue
Block a user