onReady() {
let lan = this.$i18n.locale;
if (lan != 'en') {
uni.setNavigationBarTitle({
title: '测试'
});
uni.setTabBarItem({
index: 0,
text: this.$i18n.messages[lan].tabBar.home
});
uni.setTabBarItem({
index: 1,
text: this.$i18n.messages[lan].tabBar.category
});
uni.setTabBarItem({
index: 2,
text: this.$i18n.messages[lan].tabBar.meal
});
uni.setTabBarItem({
index: 3,
text: this.$i18n.messages[lan].tabBar.cart
});
uni.setTabBarItem({
index: 4,
text: this.$i18n.messages[lan].tabBar.my
});
}
this.getCategory();
this.getHotGoods();
this.getGoods();
},

- 发布:2020-06-03 10:54
- 更新:2020-06-03 10:54
- 阅读:687
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10 1909
HBuilderX类型: 正式
HBuilderX版本号: 2.7.9
手机系统: Android
手机系统版本号: Android 9.0
手机厂商: 华为
手机机型: 雷电模拟器&&华为PAR-AL00
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
onReady() {
let lan = this.$i18n.locale;
if (lan != 'en') {
uni.setNavigationBarTitle({
title: '测试'
});
uni.setTabBarItem({
index: 0,
text: this.$i18n.messages[lan].tabBar.home
});
uni.setTabBarItem({
index: 1,
text: this.$i18n.messages[lan].tabBar.category
});
uni.setTabBarItem({
index: 2,
text: this.$i18n.messages[lan].tabBar.meal
});
uni.setTabBarItem({
index: 3,
text: this.$i18n.messages[lan].tabBar.cart
});
uni.setTabBarItem({
index: 4,
text: this.$i18n.messages[lan].tabBar.my
});
}
this.getCategory();
this.getHotGoods();
this.getGoods();
},
onReady() {
let lan = this.$i18n.locale;
if (lan != 'en') {
uni.setNavigationBarTitle({
title: '测试'
});
uni.setTabBarItem({
index: 0,
text: this.$i18n.messages[lan].tabBar.home
});
uni.setTabBarItem({
index: 1,
text: this.$i18n.messages[lan].tabBar.category
});
uni.setTabBarItem({
index: 2,
text: this.$i18n.messages[lan].tabBar.meal
});
uni.setTabBarItem({
index: 3,
text: this.$i18n.messages[lan].tabBar.cart
});
uni.setTabBarItem({
index: 4,
text: this.$i18n.messages[lan].tabBar.my
});
}
this.getCategory();
this.getHotGoods();
this.getGoods();
},
预期结果:
打印success日志setNavigationBarTitle:ok,导航条标题更新
打印success日志setNavigationBarTitle:ok,导航条标题更新
实际结果:
打印success日志setNavigationBarTitle:ok,导航条标题不更新
打印success日志setNavigationBarTitle:ok,导航条标题不更新
bug描述:
tabBar页面设置标题无效
0 个回复