|
@@ -10,9 +10,6 @@ import { CAMELIZE } from '../runtimeHelpers'
|
|
|
export const transformBind: DirectiveTransform = (dir, node, context) => {
|
|
export const transformBind: DirectiveTransform = (dir, node, context) => {
|
|
|
const { exp, modifiers, loc } = dir
|
|
const { exp, modifiers, loc } = dir
|
|
|
const arg = dir.arg!
|
|
const arg = dir.arg!
|
|
|
- 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
|
|
// .prop is no longer necessary due to new patch behavior
|
|
|
// .sync is replaced by v-model:arg
|
|
// .sync is replaced by v-model:arg
|
|
|
if (modifiers.includes('camel')) {
|
|
if (modifiers.includes('camel')) {
|
|
@@ -27,9 +24,18 @@ export const transformBind: DirectiveTransform = (dir, node, context) => {
|
|
|
arg.children.push(`)`)
|
|
arg.children.push(`)`)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (
|
|
|
|
|
+ !exp ||
|
|
|
|
|
+ (exp.type === NodeTypes.SIMPLE_EXPRESSION && !exp.content.trim())
|
|
|
|
|
+ ) {
|
|
|
|
|
+ context.onError(createCompilerError(ErrorCodes.X_V_BIND_NO_EXPRESSION, loc))
|
|
|
|
|
+ return {
|
|
|
|
|
+ props: [createObjectProperty(arg!, createSimpleExpression('', true, loc))]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return {
|
|
return {
|
|
|
- props: [
|
|
|
|
|
- createObjectProperty(arg!, exp || createSimpleExpression('', true, loc))
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ props: [createObjectProperty(arg!, exp)]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|