81 lines
2.1 KiB
JavaScript
81 lines
2.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const _sfc_main = {
|
|
__name: "tabbar",
|
|
props: {
|
|
path: {
|
|
type: String,
|
|
default: ""
|
|
}
|
|
},
|
|
setup(__props) {
|
|
const data = __props;
|
|
let list = common_vendor.ref([
|
|
{
|
|
pagePath: "/pages/home/home",
|
|
text: "首页",
|
|
icon_select: "/static/tabbar/select_home.png",
|
|
icon: "/static/tabbar/home.png",
|
|
type: 0
|
|
},
|
|
{
|
|
pagePath: "/pages/index/index",
|
|
text: "地图",
|
|
icon_select: "/static/tabbar/select_sq.png",
|
|
icon: "/static/tabbar/sq.png",
|
|
type: 0
|
|
},
|
|
{
|
|
pagePath: "/pages/sweep/sweep",
|
|
text: "扫码充电",
|
|
icon_select: "/static/tabbar/find.png",
|
|
icon: "/static/tabbar/find.png",
|
|
type: 1
|
|
},
|
|
{
|
|
pagePath: "/pages/order/order",
|
|
text: "订单",
|
|
icon_select: "/static/tabbar/select_order.png",
|
|
icon: "/static/tabbar/order.png",
|
|
type: 0
|
|
},
|
|
{
|
|
pagePath: "/pages/mine/mine",
|
|
text: "我的",
|
|
icon_select: "/static/tabbar/select_my.png",
|
|
icon: "/static/tabbar/my.png",
|
|
type: 0
|
|
}
|
|
]);
|
|
const toLink = (e) => {
|
|
common_vendor.index.vibrateShort();
|
|
if (data.path == e)
|
|
return true;
|
|
common_vendor.index.switchTab({
|
|
url: e
|
|
});
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.f(common_vendor.unref(list), (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: item.type == 1
|
|
}, item.type == 1 ? {
|
|
b: item.icon,
|
|
c: common_vendor.t(item.text),
|
|
d: __props.path == item.pagePath ? "#4879e6" : ""
|
|
} : {
|
|
e: __props.path == item.pagePath ? item.icon : item.icon_select,
|
|
f: common_vendor.t(item.text),
|
|
g: __props.path == item.pagePath ? "#4879e6" : ""
|
|
}, {
|
|
h: index,
|
|
i: common_vendor.o(($event) => toLink(item.pagePath))
|
|
});
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
my.createComponent(_sfc_main);
|