]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore(compiler-core): improve X_V_IF_KEY error message (#1757)
authorAurelius333 <22969541+Aurelius333@users.noreply.github.com>
Mon, 3 Aug 2020 21:14:14 +0000 (17:14 -0400)
committerGitHub <noreply@github.com>
Mon, 3 Aug 2020 21:14:14 +0000 (17:14 -0400)
packages/compiler-core/src/errors.ts

index 4af23216335f68a28cfa3f9de06cc003d4e9ade2..58b10259e7327b5d7601c67fb7afad5bd0a1683a 100644 (file)
@@ -136,7 +136,10 @@ export const errorMessages: { [code: number]: string } = {
 
   // transform errors
   [ErrorCodes.X_V_IF_NO_EXPRESSION]: `v-if/v-else-if is missing expression.`,
-  [ErrorCodes.X_V_IF_KEY]: `v-if branches must use compiler generated keys.`,
+  [ErrorCodes.X_V_IF_KEY]:
+    `v-if branches must use compiler generated keys. ` +
+    `In many cases, you can simply remove this key. ` +
+    `If this tag is inside of a <template v-for="...">, then you can move the key up to the parent <template>.`,
   [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.`,