import { w as withInstall } from "../badge/index2.js"; import { defineComponent, getCurrentInstance, useSlots, inject, reactive, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from "vue"; const TabInjectKey = Symbol("layuiTab"); const __default__ = { name: "LayTabItem" }; const _sfc_main = defineComponent({ ...__default__, props: { id: null, title: null, icon: null, closable: { type: [Boolean, String], default: true } }, setup(__props) { var _a; const props = __props; const instance = getCurrentInstance(); const slots = useSlots(); const active = inject("active"); const tabsCtx = inject(TabInjectKey, {}); const data = reactive({ id: props.id, title: props.title, icon: props.icon, closable: props.closable, slots }); if (instance == null ? void 0 : instance.uid) { (_a = tabsCtx.addItem) == null ? void 0 : _a.call(tabsCtx, props.id, data); } onBeforeUnmount(() => { var _a2; if (instance == null ? void 0 : instance.uid) { (_a2 = tabsCtx.removeItem) == null ? void 0 : _a2.call(tabsCtx, props.id); } }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["layui-tab-item", [unref(active) === __props.id ? "layui-show" : ""]]) }, [ renderSlot(_ctx.$slots, "default") ], 2); }; } }); const component = withInstall(_sfc_main); export { TabInjectKey as T, _sfc_main as _, component as c };