]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: $scopedSlots compat
authorEvan You <yyx990803@gmail.com>
Thu, 8 Apr 2021 14:21:14 +0000 (10:21 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 8 Apr 2021 14:21:14 +0000 (10:21 -0400)
packages/runtime-core/src/compat/deprecations.ts
packages/runtime-core/src/compat/instance.ts

index 516cd557820c470e1dc9668186bc3687e6f3b3d9..aec9391d2028bd0f88c96f495f15d0b54e0d9f8c 100644 (file)
@@ -24,6 +24,7 @@ export const enum DeprecationTypes {
   INSTANCE_EVENT_HOOKS = 'INSTANCE_EVENT_HOOKS',
   INSTANCE_CHILDREN = 'INSTANCE_CHILDREN',
   INSTANCE_LISTENERS = 'INSTANCE_LISTENERS',
+  INSTANCE_SCOPED_SLOTS = 'INSTANCE_SCOPED_SLOTS',
 
   OPTIONS_DATA_FN = 'OPTIONS_DATA_FN',
   OPTIONS_DATA_MERGE = 'OPTIONS_DATA_MERGE',
@@ -182,6 +183,11 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
     link: `https://v3.vuejs.org/guide/migration/listeners-removed.html`
   },
 
+  [DeprecationTypes.INSTANCE_SCOPED_SLOTS]: {
+    message: `vm.$scopedSlots has been removed. Use vm.$slots instead.`,
+    link: `https://v3.vuejs.org/guide/migration/slots-unification.html`
+  },
+
   [DeprecationTypes.OPTIONS_DATA_FN]: {
     message:
       `The "data" option can no longer be a plain object. ` +
index cbb4774f6752c964e4314264ea85d8e2bc71dc7b..88897e125cb6f8b4a5397ecf8d98d2afa45b0ae3 100644 (file)
@@ -20,23 +20,33 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
       assertCompatEnabled(DeprecationTypes.INSTANCE_SET)
       return set
     },
+
     $delete: () => {
       assertCompatEnabled(DeprecationTypes.INSTANCE_DELETE)
       return del
     },
+
     $mount: i => {
       assertCompatEnabled(DeprecationTypes.GLOBAL_MOUNT)
       // root mount override from ./global.ts in installCompatMount
       return i.ctx._compat_mount || NOOP
     },
+
     $destroy: i => {
       assertCompatEnabled(DeprecationTypes.INSTANCE_DESTROY)
       // root destroy override from ./global.ts in installCompatMount
       return i.ctx._compat_destroy || NOOP
     },
+
+    $scopedSlots: i => {
+      assertCompatEnabled(DeprecationTypes.INSTANCE_SCOPED_SLOTS)
+      return i.slots
+    },
+
     $on: i => on.bind(null, i),
     $once: i => once.bind(null, i),
     $off: i => off.bind(null, i),
+
     $children: getCompatChildren,
     $listeners: getCompatListeners
   } as PublicPropertiesMap)