29 lines
565 B
JavaScript
29 lines
565 B
JavaScript
// TabBar 国际化工具
|
|
export const updateTabBarI18n = (vm) => {
|
|
if (!vm || !vm.$t) return
|
|
|
|
try {
|
|
uni.setTabBarItem({
|
|
index: 0,
|
|
text: vm.$t('tabbar.home')
|
|
})
|
|
uni.setTabBarItem({
|
|
index: 1,
|
|
text: vm.$t('tabbar.appointment')
|
|
})
|
|
uni.setTabBarItem({
|
|
index: 2,
|
|
text: vm.$t('tabbar.me')
|
|
})
|
|
} catch (e) {
|
|
console.error('更新 TabBar 国际化失败:', e)
|
|
}
|
|
}
|
|
|
|
// 混入对象,用于在页面中自动更新 TabBar
|
|
export const tabBarI18nMixin = {
|
|
onShow() {
|
|
updateTabBarI18n(this)
|
|
}
|
|
}
|