song-ui-u
Version:
vue3 + js的PC前端组件库
39 lines (36 loc) • 892 B
JavaScript
import { defineComponent, inject, ref, onMounted, withDirectives, createVNode, vShow } from 'vue';
import { TAB_KEY } from '../constant.mjs';
var tabPane = /* @__PURE__ */ defineComponent({
name: "x-tab-pane",
props: {
label: {
type: String,
required: true
},
name: {
type: String,
required: true
}
},
setup(props, {
slots
}) {
const tabsContext = inject(TAB_KEY, {
activeName: ref(""),
registerPane: () => {
},
handleTabClick: () => {
},
props: {}
});
onMounted(() => {
tabsContext.registerPane({
name: props.name,
label: props.label
});
});
return () => withDirectives(createVNode("div", null, [slots.default?.()]), [[vShow, tabsContext.activeName.value === props.name]]);
}
});
export { tabPane as default };
//# sourceMappingURL=tab-pane.mjs.map