]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: function slot tips
authorEvan You <yyx990803@gmail.com>
Fri, 30 Aug 2019 19:34:57 +0000 (15:34 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 30 Aug 2019 19:34:57 +0000 (15:34 -0400)
packages/runtime-core/src/componentSlots.ts

index 44753fd8fd9adc45ec0bf52cb48a692832ae8c95..2cff5e0b734a23ef4f6897997363cf7127175bd6 100644 (file)
@@ -47,8 +47,10 @@ export function resolveSlots(
           ;(slots as any)[key] = normalizeSlot(key, value)
         } else {
           if (__DEV__) {
-            // TODO show tip on using functions
-            console.log('use function slots!')
+            warn(
+              `Non-function value encountered for slot "${key}". ` +
+                `Prefer function slots for better performance.`
+            )
           }
           value = normalizeSlotValue(value)
           ;(slots as any)[key] = () => value
@@ -58,8 +60,10 @@ export function resolveSlots(
   } else if (children !== null) {
     // non slot object children (direct value) passed to a component
     if (__DEV__) {
-      // TODO show tip on using functions
-      console.log('use function slots!')
+      warn(
+        `Non-function value encountered for default slot. ` +
+          `Prefer function slots for better performance.`
+      )
     }
     const normalized = normalizeSlotValue(children)
     slots = { default: () => normalized }