2024-08-02 18:19:39 +08:00

16 lines
480 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getVNodeChildren = getVNodeChildren;
function getVNodeChildren(vNode, slotName = 'default', fallback = []) {
const { children } = vNode;
if (children !== null
&& typeof children === 'object'
&& !Array.isArray(children)) {
const slot = children[slotName];
if (typeof slot === 'function') {
return slot();
}
}
return fallback;
}