36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../common/vendor.js");
|
|
const TAB_BAR_PAGES = ["pages/index/index", "pages/appointment/appointment-page", "pages/me/me-page"];
|
|
const isTabBarPage = () => {
|
|
const pages = getCurrentPages();
|
|
if (pages.length === 0)
|
|
return false;
|
|
const currentPage = pages[pages.length - 1];
|
|
const currentRoute = currentPage.route || "";
|
|
return TAB_BAR_PAGES.includes(currentRoute);
|
|
};
|
|
const updateTabBarI18n = (vm) => {
|
|
if (!vm || !vm.$t)
|
|
return;
|
|
if (!isTabBarPage())
|
|
return;
|
|
try {
|
|
common_vendor.index.setTabBarItem({
|
|
index: 0,
|
|
text: vm.$t("tabbar.home")
|
|
});
|
|
common_vendor.index.setTabBarItem({
|
|
index: 1,
|
|
text: vm.$t("tabbar.appointment")
|
|
});
|
|
common_vendor.index.setTabBarItem({
|
|
index: 2,
|
|
text: vm.$t("tabbar.me")
|
|
});
|
|
} catch (e) {
|
|
common_vendor.index.__f__("error", "at utils/tabbar-i18n.js:34", "更新 TabBar 国际化失败:", e);
|
|
}
|
|
};
|
|
exports.updateTabBarI18n = updateTabBarI18n;
|
|
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/tabbar-i18n.js.map
|