UNPKG

vuestic-ui

Version:
27 lines (26 loc) 826 B
import { getCurrentInstance, computed, isVNode } from "vue"; import { i as isFunction } from "../utils/is-function.js"; const checkSlotChildrenDeep = (v, initial = true) => { var _a; if (isVNode(v)) { return true; } if (!v || initial && (!isFunction(v) || !((_a = v()) == null ? void 0 : _a.length))) { return false; } const slotData = initial ? v() : v; if (Array.isArray(slotData)) { return slotData.some((el) => { return Array.isArray(el.children) ? checkSlotChildrenDeep(el.children, false) : el.children || el.props; }); } return !!slotData.children; }; const useSlotPassed = (name = "default") => { const { slots } = getCurrentInstance(); return computed(() => checkSlotChildrenDeep(slots[name])); }; export { useSlotPassed as u }; //# sourceMappingURL=useSlotPassed.js.map