添加 setBarTitles 方法,集中设置浏览器窗口标题+页面导航栏标题+页面标签栏标题

This commit is contained in:
陆柯 2020-06-04 15:25:50 +08:00
parent 9fad1ec855
commit dcc8e47656

View File

@ -95,6 +95,14 @@ module.exports = {
}
},
setBarTitles({windowTitle, pageTitle}={}){
uni.setNavigationBarTitle({ title: pageTitle || this.localeText.tPageTitle })
// #ifdef H5
document.title = windowTitle || this.appName || this.$store.getters['i18n/getAppName'] // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。
// #endif
this.$store.commit('i18n/setTabbar') // 必须要在有 tab 的页面里重置才能成功
},
formatMoney(value, decimal){
return Number(value).toFixed(decimal||2)
},