fix(runtime-core): ensure consistent arguments for tempalte and render funtion slot usage

fix #4367
This commit is contained in:
Evan You 2021-08-17 11:15:53 -04:00
parent c1f564e1dc
commit 644971ec06

View File

@ -63,7 +63,7 @@ const normalizeSlot = (
rawSlot: Function, rawSlot: Function,
ctx: ComponentInternalInstance | null | undefined ctx: ComponentInternalInstance | null | undefined
): Slot => { ): Slot => {
const normalized = withCtx((props: any) => { const normalized = withCtx((...args: any[]) => {
if (__DEV__ && currentInstance) { if (__DEV__ && currentInstance) {
warn( warn(
`Slot "${key}" invoked outside of the render function: ` + `Slot "${key}" invoked outside of the render function: ` +
@ -71,7 +71,7 @@ const normalizeSlot = (
`Invoke the slot function inside the render function instead.` `Invoke the slot function inside the render function instead.`
) )
} }
return normalizeSlotValue(rawSlot(props)) return normalizeSlotValue(rawSlot(...args))
}, ctx) as Slot }, ctx) as Slot
// NOT a compiled slot // NOT a compiled slot
;(normalized as ContextualRenderFn)._c = false ;(normalized as ContextualRenderFn)._c = false