77 lines
2.4 KiB
JavaScript
77 lines
2.4 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../common/vendor.js");
|
|
const _sfc_main = {
|
|
name: "custom-tab-bar",
|
|
props: {
|
|
tabIndex: {
|
|
//当前选中的tab项
|
|
type: Number,
|
|
default: 0
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
tabs: [
|
|
{
|
|
"pagePath": "/pages/home/home",
|
|
"text": "首页",
|
|
"iconPath": "/static/column/home.png",
|
|
"selectedIconPath": "/static/column/home_sel.png"
|
|
},
|
|
{
|
|
"pagePath": "/pages/sort/sort",
|
|
"text": "分类",
|
|
"iconPath": "/static/column/sort.png",
|
|
"selectedIconPath": "/static/column/sort_sel.png"
|
|
},
|
|
// {
|
|
// "pagePath": "/pages/hash_union/hash_union",
|
|
// "text": "哈希联盟",
|
|
// "iconPath": "/static/column/hx.png",
|
|
// "selectedIconPath": "/static/column/hx_sel.png"
|
|
// },
|
|
{
|
|
"pagePath": "/pages/supply_chain/supply_chain",
|
|
"text": "供应链",
|
|
"iconPath": "/static/column/supply_chain.png",
|
|
"selectedIconPath": "/static/column/supply_chain_sel.png"
|
|
},
|
|
{
|
|
"pagePath": "/pages/shopping_cart/shopping_cart",
|
|
"text": "购物车",
|
|
"iconPath": "/static/column/shopping.png",
|
|
"selectedIconPath": "/static/column/shopping_sel.png"
|
|
},
|
|
{
|
|
"pagePath": "/pages/mine/mine",
|
|
"text": "我的",
|
|
"iconPath": "/static/column/mine.png",
|
|
"selectedIconPath": "/static/column/mine_sel.png"
|
|
}
|
|
]
|
|
};
|
|
},
|
|
methods: {
|
|
switchTab(index) {
|
|
const pagePath = this.tabs[index].pagePath;
|
|
common_vendor.index.switchTab({ url: pagePath });
|
|
}
|
|
}
|
|
};
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.f($data.tabs, (item, index, i0) => {
|
|
return {
|
|
a: $props.tabIndex === index ? item.selectedIconPath : item.iconPath,
|
|
b: common_vendor.t(item.text),
|
|
c: common_vendor.n($props.tabIndex === index ? "tab-text tab-text-sel" : "tab-text"),
|
|
d: index,
|
|
e: common_vendor.o(($event) => $options.switchTab(index), index)
|
|
};
|
|
})
|
|
};
|
|
}
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8fac706f"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/custom-tab-bar.js.map
|