Files
tk-mini-program/unpackage/dist/dev/mp-weixin/components/tabBar/tabBar.js

98 lines
3.1 KiB
JavaScript
Raw Normal View History

2025-05-12 22:19:21 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
__name: "tabBar",
props: {
tabIndex: Number
},
setup(__props) {
let showMiddleButton = common_vendor.ref(false);
let tabList = common_vendor.reactive([
{
iconPath: "../../static/Pk.png",
selectedIconPath: "../../static/PkClick.png",
text: "PK",
2025-05-14 16:09:14 +08:00
pagePath: "/pages/Home/Home",
2025-05-12 22:19:21 +08:00
middleClass: ""
},
{
iconPath: "../../static/Forum.png",
selectedIconPath: "../../static/Forumclick.png",
text: "论坛",
pagePath: "",
middleClass: ""
},
{
iconPath: "../../static/jiahao.png",
selectedIconPath: "../../static/jiahao.png",
text: "",
pagePath: "/pages/c/c",
middleClass: ""
},
{
iconPath: "../../static/Message.png",
selectedIconPath: "../../static/Messageclick.png",
2025-05-14 16:09:14 +08:00
text: "消息"
2025-05-12 22:19:21 +08:00
},
{
iconPath: "../../static/Mine.png",
selectedIconPath: "../../static/Mineclick.png",
text: "我的",
2025-05-13 22:16:09 +08:00
pagePath: "../../pages/Mine/Mine",
2025-05-12 22:19:21 +08:00
middleClass: ""
}
]);
common_vendor.onMounted(() => {
setTabBar();
});
common_vendor.index.getSystemInfo({
success: function(res) {
2025-05-14 16:09:14 +08:00
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:82", "机型", res.deviceType);
2025-05-12 22:19:21 +08:00
if (res.safeArea.top > 40) {
2025-05-14 16:09:14 +08:00
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:84", "苹果的底部栏大小", res.safeArea.top);
2025-05-12 22:19:21 +08:00
}
}
});
function setTabBar() {
let tabLength = tabList.length;
if (tabLength % 2) {
showMiddleButton.value = true;
let middleIndex = Math.floor(tabLength / 2);
tabList[middleIndex].middleClass = "mid-button";
}
}
common_vendor.ref();
const disabledScroll = () => {
return false;
};
2025-05-13 16:03:28 +08:00
function handlePush(item, index) {
2025-05-14 16:09:14 +08:00
if (item.text === "消息") {
common_vendor.index.navigateTo({ url: "/TUIKit/components/TUIConversation/index" });
} else {
2025-05-13 16:03:28 +08:00
common_vendor.index.switchTab({
url: item.pagePath
});
}
}
2025-05-12 22:19:21 +08:00
return (_ctx, _cache) => {
return {
a: common_vendor.f(common_vendor.unref(tabList), (item, index, i0) => {
return {
a: __props.tabIndex == index ? item.selectedIconPath : item.iconPath,
b: common_vendor.t(item.text),
c: __props.tabIndex == index ? "#1DD2F9" : "#A7A3A3",
d: common_vendor.n("list-item flex flex-column flex-middle " + item.middleClass),
2025-05-13 19:39:53 +08:00
e: common_vendor.o$1(($event) => handlePush(item), index),
2025-05-12 22:19:21 +08:00
f: index
};
}),
b: common_vendor.n(common_vendor.unref(showMiddleButton) === true ? "tab-list-middle" : "tab-list-default"),
2025-05-13 19:39:53 +08:00
c: common_vendor.o$1(disabledScroll)
2025-05-12 22:19:21 +08:00
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c497a889"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/tabBar/tabBar.js.map