@frankhoodbs/slot-helper
v1.2.11
Published
Simple utilities to check if a slot is available or isn't empty
Downloads
266
Keywords
Readme
Slot helper
This is a helper used to check if a slot is available or is not empty.
Usage
import { isSlotAvailable, isSlotNotEmpty } from '../src';
// Slots
const slots = defineSlots<{
'default'?: (props: {}) => any;
'content'?: (props: {}) => any;
}>();
const hasSlot = (name: 'default' | 'content'): boolean => isSlotAvailable(slots, name);
const hasSlotNotEmpty = (name: 'default' | 'content'): boolean => isSlotNotEmpty(slots, name);
// on the template v-if="hasSlot('default')"