cione-comp-lib
Version:
`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`
81 lines (80 loc) • 2.73 kB
JavaScript
import { defineComponent, ref, toRefs, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, toDisplayString, normalizeClass } from "vue";
import "./index.vue_vue_type_style_index_0_scoped_true_lang.mjs";
import _export_sfc from "../../_virtual/plugin-vue_export-helper.mjs";
const _sfc_main = defineComponent({
name: "CoCustomTabbar",
props: {
dataTabs: {
type: Array
},
fontFamily: {
type: String
},
tabStyle: {
type: Object
},
contentStyle: {
type: Object
},
dataKey: {
type: String
}
},
setup(props, { emit }) {
const activeIndex = ref(0);
console.log(props);
const onTabBar = (index) => {
activeIndex.value = index;
};
return {
activeIndex,
onTabBar,
...toRefs(props)
};
}
});
const _hoisted_1 = { class: "co-custom-tabbar" };
const _hoisted_2 = { class: "tab" };
const _hoisted_3 = ["onClick"];
const _hoisted_4 = { class: "tab_con" };
const _hoisted_5 = ["innerHTML"];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("section", _hoisted_1, [
createElementVNode("div", _hoisted_2, [
createElementVNode("div", {
class: "tab_list",
style: normalizeStyle({
backgroundColor: _ctx.tabStyle.bgColor,
fontFamily: _ctx.fontFamily,
fontSize: _ctx.tabStyle.fontSize + "px",
color: _ctx.tabStyle.fontColor
})
}, [
createElementVNode("ul", null, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataTabs, (tab, index) => {
return openBlock(), createElementBlock("li", {
style: normalizeStyle({
background: _ctx.activeIndex === index ? _ctx.tabStyle.activeColor : "rgba(63, 91, 140, 0.76)"
}),
onClick: ($event) => _ctx.onTabBar(index)
}, toDisplayString(tab.text), 13, _hoisted_3);
}), 256))
])
], 4),
createElementVNode("div", _hoisted_4, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataTabs, (tab, index) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["item", _ctx.activeIndex === index ? "active_item" : ""])
}, [
createElementVNode("div", {
class: "item_con",
innerHTML: tab.content
}, null, 8, _hoisted_5)
], 2);
}), 256))
])
])
]);
}
var CoCustomTabbar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c937d17a"]]);
export { CoCustomTabbar as default };