60 lines
1.5 KiB
JavaScript
60 lines
1.5 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/index/index",
|
|
text: "首页",
|
|
icon_select: "/static/tabbar/home.png",
|
|
icon: "/static/tabbar/homes.png",
|
|
type: 0
|
|
},
|
|
{
|
|
pagePath: "/pages/market/market",
|
|
text: "公告",
|
|
icon_select: "/static/tabbar/market.png",
|
|
icon: "/static/tabbar/markets.png",
|
|
type: 0
|
|
},
|
|
{
|
|
pagePath: "/pages/mine/mine",
|
|
text: "我的",
|
|
icon_select: "/static/tabbar/mine.png",
|
|
icon: "/static/tabbar/mines.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 {
|
|
a: __props.path == item.pagePath ? item.icon : item.icon_select,
|
|
b: common_vendor.t(item.text),
|
|
c: __props.path == item.pagePath ? "#4874E5" : "",
|
|
d: index,
|
|
e: common_vendor.o(($event) => toLink(item.pagePath))
|
|
};
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
my.createComponent(_sfc_main);
|