wip: v-bind.sync compat
This commit is contained in:
@@ -3,11 +3,15 @@ import { createObjectProperty, createSimpleExpression, NodeTypes } from '../ast'
|
||||
import { createCompilerError, ErrorCodes } from '../errors'
|
||||
import { camelize } from '@vue/shared'
|
||||
import { CAMELIZE } from '../runtimeHelpers'
|
||||
import {
|
||||
checkCompatEnabled,
|
||||
CompilerDeprecationTypes
|
||||
} from '../compat/compatConfig'
|
||||
|
||||
// v-bind without arg is handled directly in ./transformElements.ts due to it affecting
|
||||
// codegen for the entire props object. This transform here is only for v-bind
|
||||
// *with* args.
|
||||
export const transformBind: DirectiveTransform = (dir, node, context) => {
|
||||
export const transformBind: DirectiveTransform = (dir, _node, context) => {
|
||||
const { exp, modifiers, loc } = dir
|
||||
const arg = dir.arg!
|
||||
|
||||
@@ -33,6 +37,18 @@ export const transformBind: DirectiveTransform = (dir, node, context) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (__COMPAT__) {
|
||||
if (modifiers.includes('prop')) {
|
||||
checkCompatEnabled(
|
||||
CompilerDeprecationTypes.COMPILER_V_BIND_PROP,
|
||||
context,
|
||||
loc
|
||||
)
|
||||
}
|
||||
// .sync handling is performed directly in the parse phase to transform
|
||||
// it into v-model:arg equivalent.
|
||||
}
|
||||
|
||||
if (
|
||||
!exp ||
|
||||
(exp.type === NodeTypes.SIMPLE_EXPRESSION && !exp.content.trim())
|
||||
|
||||
Reference in New Issue
Block a user