uniapp 多语言 动态修改tabBar标题
uniapp 多语言 动态修改tabBar标题
·
"tabBar": {
"color": "#BDBDBD",
"selectedColor": "#1890FF",
"borderStyle": "white",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/images/tabbar_home_normal.png",
"selectedIconPath": "static/images/tabbar_home_selected.png",
"text": "%tabbar1%"
},
{
"pagePath": "pages/active/index",
"iconPath": "static/images/tabbar_order_normal.png",
"selectedIconPath": "static/images/tabbar_order_selected.png",
"text": "%tabbar2%"
},
{
"pagePath": "pages/mine/index",
"iconPath": "static/images/tabbar_mine_normal.png",
"selectedIconPath": "static/images/tabbar_mine_selected.png",
"text": "%tabbar3%"
}
]
},
// 切换语言
onLocaleChange(e) {
uni.showModal({
content: '确认更换字体?',
success: (res) => {
if (res.confirm) {
uni.setLocale(e);
uni.setTabBarItem({
index: 0,
text: this.$t('tabbar1')
})
uni.setTabBarItem({
index: 1,
text: this.$t('tabbar2')
})
uni.setTabBarItem({
index: 2,
text: this.$t('tabbar3')
})
}
}
})
},
更多推荐
已为社区贡献8条内容
所有评论(0)