]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler): warn against v-bind with empty attribute value
authorEvan You <yyx990803@gmail.com>
Thu, 7 May 2020 13:12:56 +0000 (09:12 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 7 May 2020 14:32:54 +0000 (10:32 -0400)
ref: https://github.com/vuejs/vue-next/issues/1128#issuecomment-624647434

packages/compiler-core/src/transforms/vBind.ts

index 1e5d6a98dd393d7b9c66d71d6ad3d0acceb409f1..b9e9d7debe3c118795c775a0e854f5e8cc41f2ff 100644 (file)
@@ -10,7 +10,7 @@ import { CAMELIZE } from '../runtimeHelpers'
 export const transformBind: DirectiveTransform = (dir, node, context) => {
   const { exp, modifiers, loc } = dir
   const arg = dir.arg!
-  if (!exp) {
+  if (!exp || (exp.type === NodeTypes.SIMPLE_EXPRESSION && !exp.content)) {
     context.onError(createCompilerError(ErrorCodes.X_V_BIND_NO_EXPRESSION, loc))
   }
   // .prop is no longer necessary due to new patch behavior