let currentWebview = page.$getAppWebview();
let titleNView = currentWebview.getStyle().titleNView;
titleNView.buttons[0].text = text;
currentWebview.setStyle({
titleNView: titleNView
});
官方示例导航栏带城市选择 把页面设为tabBar页面时,安卓手机提示undefined is not an object (evaluating 'titleNView.buttons')
7***@qq.com
- 发布:2020-06-16 16:44
- 更新:2020-06-16 16:59
- 阅读:799
7***@qq.com (作者)
一样的
你把他"tabBar": {
"color": "#7A7E83",
"selectedColor": "#007AFF",
"borderStyle": "black",
"backgroundColor": "#F8F8F8",
"list": [{
"pagePath": "pages/tabBar/component/component",
"iconPath": "static/component.png",
"selectedIconPath": "static/componentHL.png",
"text": "内置组件"
},
{
"pagePath": "pages/template/nav-city-dropdown/nav-city-dropdown",
"iconPath": "static/api.png",
"selectedIconPath": "static/apiHL.png",
"text": "接口"
}, {
"pagePath": "pages/tabBar/extUI/extUI",
"iconPath": "static/extui.png",
"selectedIconPath": "static/extuiHL.png",
"text": "扩展组件"
}, {
"pagePath": "pages/tabBar/template/template",
"iconPath": "static/template.png",
"selectedIconPath": "static/templateHL.png",
"text": "模板"
}
]
}换成就报错了
2020-06-16 17:19
AHMIN
回复 7***@qq.com: 我看明白你意思了。你是要修改tarBar上文字。但是你写的是修改导航栏上自定义按钮的文字。
2020-06-16 17:30
AHMIN
回复 7***@qq.com: uni.setTabBarItem({
index: 0,//代表的是第几个tarBar
text: “修改文字”
});
这才是修改tarBar的文字
2020-06-16 17:32
7***@qq.com (作者)
回复 AHMIN: 不是..... 是导航栏上带中英文切换下拉选择 当页面是tarBar里的时候 自定义按钮改不了文字
2020-06-16 17:33
AHMIN
回复 7***@qq.com: 我刚去测试了。没重现你的问题。我写在tarBar是也是正常的
2020-06-16 17:41
7***@qq.com (作者)
回复 AHMIN:我是安卓真机就会报错
2020-06-17 08:36