vuestic-ui
Version:
Vue 3 UI Framework
32 lines (31 loc) • 819 B
JavaScript
import { defineComponent, h } from "vue";
const WithSlotInheritance = (component) => {
return defineComponent({
name: "ProxySlots",
props: {
inheritSlots: { type: Array, required: true }
},
render() {
var _a;
const parentSlots = ((_a = this.$parent) == null ? void 0 : _a.$slots) || {};
const slotsToProxy = this.$props.inheritSlots || Object.keys(parentSlots);
const slots = slotsToProxy.reduce(
(slots2, name) => {
if (parentSlots[name]) {
slots2[name] = parentSlots[name];
}
return slots2;
},
{}
);
return h(component, this.$attrs, {
...slots,
...this.$slots
});
}
});
};
export {
WithSlotInheritance as W
};
//# sourceMappingURL=with-slot-inheritance.mjs.map