From: Evan You Date: Thu, 7 May 2020 13:12:56 +0000 (-0400) Subject: fix(compiler): warn against v-bind with empty attribute value X-Git-Tag: v3.0.0-beta.10~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=675330ba542022935ebbb2d31af3ba643c37a5eb;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler): warn against v-bind with empty attribute value ref: https://github.com/vuejs/vue-next/issues/1128#issuecomment-624647434 --- diff --git a/packages/compiler-core/src/transforms/vBind.ts b/packages/compiler-core/src/transforms/vBind.ts index 1e5d6a98dd..b9e9d7debe 100644 --- a/packages/compiler-core/src/transforms/vBind.ts +++ b/packages/compiler-core/src/transforms/vBind.ts @@ -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