UNPKG

maz-ui

Version:

A standalone components library for Vue.Js 3 & Nuxt.Js 3

22 lines (21 loc) 729 B
import { Slot } from 'vue'; /** * Check if a slot renders meaningful content. * * `$slots.foo` is truthy as soon as the parent declares `<template #foo>`, * even when that template renders nothing (e.g. via `v-if="false"`). * This helper invokes the slot function and walks the returned VNodes * to detect whether any real DOM or component will be produced. * * For scoped slots that require bindings, the function falls back to * a simple existence check since they cannot be safely invoked without * the expected arguments. * * @example * ```vue * <div v-if="hasSlotContent($slots.footer)"> * <slot name="footer" /> * </div> * ``` */ export declare function hasSlotContent(slot: Slot | undefined): boolean;