13 lines
370 B
TypeScript
13 lines
370 B
TypeScript
|
import { Slot } from '../componentSlots'
|
||
|
import { VNodeChildren } from '../vnode'
|
||
|
|
||
|
export function renderSlot(
|
||
|
slot: Slot | undefined,
|
||
|
props: any = {},
|
||
|
// this is not a user-facing function, so the fallback is always generated by
|
||
|
// the compiler.
|
||
|
fallback?: string | VNodeChildren
|
||
|
): string | VNodeChildren | null {
|
||
|
return slot ? slot() : fallback || null
|
||
|
}
|