赞
踩
场景:在 tabbar
页面中,配置 原生导航栏 buttons
,切换语言时,不会实时更新问题。
{ "path": "pages/index/index", "style": { "navigationBarTitleText": "%common.index%", "enablePullDownRefresh": true, "app-plus": { "titleNView": { "backgroundImage": "linear-gradient(to right, #fe8c00, #f83600);", "buttons": [{ "text": "%common.devices%", "color": "#fff", "fontSize": "18", "width": 100, "float": "left" }, { "text": "\ue600", "color": "#fff", "fontSize": "26", "width": 60, "float": "right", "fontSrc": "/static/iconfont/iconfont.ttf" } } } } }
这里用简单粗暴方式,在
onShow
调用方法,获取当前webview
对象,使用国际化 再次设置buttons
,以达更新实时文案。欢迎分享其他方案~
let webView = this.$mp.page.$getAppWebview();
webView.setTitleNViewButtonStyle(0, {
text: this.$t('common.devices')
});
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。