From: Evan You Date: Fri, 30 Aug 2019 19:34:57 +0000 (-0400) Subject: wip: function slot tips X-Git-Tag: v3.0.0-alpha.0~860 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d5684e1a9d99012f0359f487a46a5794de90b9ae;p=thirdparty%2Fvuejs%2Fcore.git wip: function slot tips --- diff --git a/packages/runtime-core/src/componentSlots.ts b/packages/runtime-core/src/componentSlots.ts index 44753fd8fd..2cff5e0b73 100644 --- a/packages/runtime-core/src/componentSlots.ts +++ b/packages/runtime-core/src/componentSlots.ts @@ -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 }