From 86703c23a685146ded101b3bc05eee298a60311a Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 26 Apr 2021 17:35:41 -0400 Subject: [PATCH] wip: ref v-for compat --- .../compiler-core/src/compat/compatConfig.ts | 8 ++++ .../src/transforms/transformElement.ts | 19 ++++++++ .../runtime-core/src/compat/compatConfig.ts | 24 +++++++--- packages/runtime-core/src/compat/ref.ts | 45 +++++++++++++++++++ packages/runtime-core/src/compat/renderFn.ts | 4 +- packages/runtime-core/src/renderer.ts | 36 ++++++++------- packages/runtime-core/src/vnode.ts | 9 +++- 7 files changed, 117 insertions(+), 28 deletions(-) create mode 100644 packages/runtime-core/src/compat/ref.ts diff --git a/packages/compiler-core/src/compat/compatConfig.ts b/packages/compiler-core/src/compat/compatConfig.ts index 717b8dc4..d43c441d 100644 --- a/packages/compiler-core/src/compat/compatConfig.ts +++ b/packages/compiler-core/src/compat/compatConfig.ts @@ -20,6 +20,7 @@ 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' @@ -78,6 +79,13 @@ 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: `