yuang-framework-ui-pc
Version:
yuang-framework-ui-pc Library
74 lines (73 loc) • 2.17 kB
JavaScript
import { defineComponent, reactive, provide, watch, onBeforeMount, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
import { TAB_WRAP_KEY } from "../ele-tabs/props";
import { tabWrapProps } from "./props";
const _sfc_main = defineComponent({
name: "EleTabWrap",
props: tabWrapProps,
setup(props) {
const tabMethods = {};
const data = reactive({
size: props.size,
type: props.type,
setTabMethods: (methods) => {
tabMethods.triggerTabItemClick = methods.triggerTabItemClick;
tabMethods.triggerItemContextMenu = methods.triggerItemContextMenu;
},
triggerTabItemClick: (item, tabName, e) => {
if (tabMethods.triggerTabItemClick) {
tabMethods.triggerTabItemClick(item, tabName, e);
}
},
triggerItemContextMenu: (item, tabName, e) => {
if (tabMethods.triggerItemContextMenu) {
tabMethods.triggerItemContextMenu(item, tabName, e);
}
}
});
provide(TAB_WRAP_KEY, data);
watch(
() => props.size,
() => {
data.size = props.size;
}
);
watch(
() => props.type,
() => {
data.type = props.type;
}
);
onBeforeMount(() => {
tabMethods.triggerTabItemClick = void 0;
tabMethods.triggerItemContextMenu = void 0;
});
return {};
}
});
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", {
class: normalizeClass([
"ele-tab-wrap",
"ele-tabs-wrap",
{ "is-small": _ctx.size === "small" },
{ "is-large": _ctx.size === "large" },
{ "is-simple": _ctx.type === "simple" },
{ "is-indicator": _ctx.type === "indicator" },
{ "is-button": _ctx.type === "button" },
{ "is-tag": _ctx.type === "tag" }
])
}, [
renderSlot(_ctx.$slots, "default")
], 2);
}
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
index as default
};