@fecp/mobile
Version:
90 lines (89 loc) • 3.61 kB
JavaScript
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
/* empty css */
import { computed, createElementBlock, openBlock, normalizeStyle, unref, createVNode, createElementVNode, mergeProps, isRef, withCtx, Fragment, renderList, createBlock, renderSlot } from "vue";
/* empty css */
import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
import { Tabs } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/tabs/index.mjs";
import { Tab } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/tab/index.mjs";
const _hoisted_1 = { class: "fec-tab-content" };
const _sfc_main = {
__name: "Tabs",
props: {
modelValue: {
type: String,
default: ""
},
options: {
type: Array,
default: []
},
autoHeight: {
//高度自适应
type: Boolean,
default: true
},
height: {
//高度
type: String,
default: "300"
}
},
emits: ["update:modelValue"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const activeName = computed({
get: () => {
return props.modelValue;
},
set: (val) => {
emit("update:modelValue", val);
}
});
const compHeight = computed(() => {
if (props.autoHeight) {
return "100%";
} else {
return props.height + "px";
}
});
return (_ctx, _cache) => {
const _component_van_tab = Tab;
const _component_van_tabs = Tabs;
return openBlock(), createElementBlock("div", {
class: "fec-tabs-container",
style: normalizeStyle("height:" + unref(compHeight))
}, [
createVNode(_component_van_tabs, mergeProps(_ctx.$attrs, {
class: "fec-tabs",
active: unref(activeName),
"onUpdate:active": _cache[0] || (_cache[0] = ($event) => isRef(activeName) ? activeName.value = $event : null),
animated: "",
ellipsis: ""
}), {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item) => {
return openBlock(), createBlock(_component_van_tab, mergeProps({ ref_for: true }, item, {
"show-zero-badge": false,
replace: ""
}), null, 16);
}), 256))
]),
_: 1
}, 16, ["active"]),
createElementVNode("div", _hoisted_1, [
renderSlot(_ctx.$slots, "default", {}, void 0, true)
])
], 4);
};
}
};
const _Tabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b371b7d3"]]);
export {
_Tabs as default
};