acdr-ui/dist/dev/mp-weixin/components/Tabbar.js
2024-10-01 09:15:35 +08:00

34 lines
1.1 KiB
JavaScript

"use strict";
const common_vendor = require("../common/vendor.js");
const store_routers = require("../store/routers.js");
const _sfc_main = {
__name: "Tabbar",
setup(__props) {
const routersStore = store_routers.useRoutersStore();
function switchTab(item) {
routersStore.setCurrentTab(item.pagePath);
if (item.pagePath === "/pages/index/index") {
common_vendor.index.switchTab({ url: "/pages/index/index" });
return;
}
common_vendor.index.navigateTo({
url: item.pagePath
});
}
return (_ctx, _cache) => {
return {
a: common_vendor.f(common_vendor.unref(routersStore).tabList, (item, index, i0) => {
return {
a: common_vendor.unref(routersStore).selected === index ? item.selectedIconPath : item.iconPath,
b: common_vendor.t(item.text),
c: index,
d: common_vendor.unref(routersStore).selected === index ? 1 : "",
e: common_vendor.o(($event) => switchTab(item), index)
};
})
};
};
}
};
wx.createComponent(_sfc_main);