diff --git a/packages/compiler-core/__tests__/transforms/transformElement.spec.ts b/packages/compiler-core/__tests__/transforms/transformElement.spec.ts index b72533ee3f9..138fa1005c4 100644 --- a/packages/compiler-core/__tests__/transforms/transformElement.spec.ts +++ b/packages/compiler-core/__tests__/transforms/transformElement.spec.ts @@ -936,7 +936,7 @@ describe('compiler: element transform', () => { expect(node.patchFlag).toBe(genFlagText(PatchFlags.NEED_PATCH)) }) - test('the binding exists (inline ref input)', () => { + test('script setup inline mode template ref (binding exists)', () => { const { node } = parseWithElementTransform(``, { inline: true, bindingMetadata: { @@ -949,104 +949,32 @@ describe('compiler: element transform', () => { { type: NodeTypes.JS_PROPERTY, key: { - type: NodeTypes.SIMPLE_EXPRESSION, - content: 'ref', + content: 'ref_key', isStatic: true }, value: { - type: NodeTypes.JS_FUNCTION_EXPRESSION, - params: ['_value', '_refs'], - body: { - type: NodeTypes.JS_BLOCK_STATEMENT, - body: [ - { - content: `_refs['input'] = _value` - }, - { - content: 'input.value = _value' - } - ] - } - } - } - ] - }) - }) - - test('the binding not exists (inline ref input)', () => { - const { node } = parseWithElementTransform(``, { - inline: true - }) - expect(node.props).toMatchObject({ - type: NodeTypes.JS_OBJECT_EXPRESSION, - properties: [ - { - type: NodeTypes.JS_PROPERTY, - key: { - type: NodeTypes.SIMPLE_EXPRESSION, - content: 'ref', + content: 'input', isStatic: true - }, - value: { - type: NodeTypes.JS_FUNCTION_EXPRESSION, - params: ['_value', '_refs'], - body: { - type: NodeTypes.JS_BLOCK_STATEMENT, - body: [ - { - content: `_refs['input'] = _value` - } - ] - } } - } - ] - }) - }) - - test('the binding not exists (inline maybe ref input)', () => { - const { node } = parseWithElementTransform(``, { - inline: true, - bindingMetadata: { - input: BindingTypes.SETUP_MAYBE_REF - } - }) - expect(node.props).toMatchObject({ - type: NodeTypes.JS_OBJECT_EXPRESSION, - properties: [ + }, { type: NodeTypes.JS_PROPERTY, key: { - type: NodeTypes.SIMPLE_EXPRESSION, content: 'ref', isStatic: true }, value: { - type: NodeTypes.JS_FUNCTION_EXPRESSION, - params: ['_value', '_refs'], - body: { - type: NodeTypes.JS_BLOCK_STATEMENT, - body: [ - { - content: `_refs['input'] = _value` - }, - { - content: '_isRef(input) && (input.value = _value)' - } - ] - } + content: 'input', + isStatic: false } } ] }) }) - test('the binding not exists (inline let ref input)', () => { + test('script setup inline mode template ref (binding does not exist)', () => { const { node } = parseWithElementTransform(``, { - inline: true, - bindingMetadata: { - input: BindingTypes.SETUP_LET - } + inline: true }) expect(node.props).toMatchObject({ type: NodeTypes.JS_OBJECT_EXPRESSION, @@ -1054,25 +982,12 @@ describe('compiler: element transform', () => { { type: NodeTypes.JS_PROPERTY, key: { - type: NodeTypes.SIMPLE_EXPRESSION, content: 'ref', isStatic: true }, value: { - type: NodeTypes.JS_FUNCTION_EXPRESSION, - params: ['_value', '_refs'], - body: { - type: NodeTypes.JS_BLOCK_STATEMENT, - body: [ - { - content: `_refs['input'] = _value` - }, - { - content: - '_isRef(input) ? input.value = _value : input = _value' - } - ] - } + content: 'input', + isStatic: true } } ] diff --git a/packages/compiler-core/src/compat/compatConfig.ts b/packages/compiler-core/src/compat/compatConfig.ts index d43c441d39a..717b8dc46ad 100644 --- a/packages/compiler-core/src/compat/compatConfig.ts +++ b/packages/compiler-core/src/compat/compatConfig.ts @@ -20,7 +20,6 @@ export const enum CompilerDeprecationTypes { COMPILER_V_BIND_OBJECT_ORDER = 'COMPILER_V_BIND_OBJECT_ORDER', COMPILER_V_ON_NATIVE = 'COMPILER_V_ON_NATIVE', COMPILER_V_IF_V_FOR_PRECEDENCE = 'COMPILER_V_IF_V_FOR_PRECEDENCE', - COMPILER_V_FOR_REF = 'COMPILER_V_FOR_REF', COMPILER_NATIVE_TEMPLATE = 'COMPILER_NATIVE_TEMPLATE', COMPILER_INLINE_TEMPLATE = 'COMPILER_INLINE_TEMPLATE', COMPILER_FILTERS = 'COMPILER_FILTER' @@ -79,13 +78,6 @@ const deprecationData: Record = { link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html` }, - [CompilerDeprecationTypes.COMPILER_V_FOR_REF]: { - message: - `Ref usage on v-for no longer creates array ref values in Vue 3. ` + - `Consider using function refs or refactor to avoid ref usage altogether.`, - link: `https://v3.vuejs.org/guide/migration/array-refs.html` - }, - [CompilerDeprecationTypes.COMPILER_NATIVE_TEMPLATE]: { message: `