improve browser title bar
This commit is contained in:
parent
0dc6e13e67
commit
d9f014201e
24
unitool.js
24
unitool.js
@ -83,16 +83,26 @@ export default {
|
|||||||
pageTitle ||
|
pageTitle ||
|
||||||
pageNow?.i18nText?.[mylang]?.tPageTitle || // 页面.vue 的 i18nText 对象
|
pageNow?.i18nText?.[mylang]?.tPageTitle || // 页面.vue 的 i18nText 对象
|
||||||
pageNow?.i18nPageTitle?.[mylang] || // 页面.vue 的 i18nPageTitle 变量
|
pageNow?.i18nPageTitle?.[mylang] || // 页面.vue 的 i18nPageTitle 变量
|
||||||
pagesJson?.pages?.find((page) => page.path === pageNow?.route)?.i18nPageTitle?.[mylang] // pages.json 的页面配置里
|
pagesJson?.pages?.find((page) => page.path === pageNow?.route)?.i18nPageTitle?.[mylang] || // pages.json 的页面配置里
|
||||||
uni.setNavigationBarTitle({ title: navibarTitle })
|
''
|
||||||
|
|
||||||
|
if (uni.getSystemInfoSync().model === 'PC') {
|
||||||
|
windowTitle =
|
||||||
|
windowTitle || wo?.envar?.callname?.[mylang] || pagesJson?.appInfo?.i18nText?.[mylang] || pagesJson?.globalStyle?.navigationBarTitleText || ''
|
||||||
|
uni.setNavigationBarTitle({ title: windowTitle + (navibarTitle ? ` - ${navibarTitle}` : '') })
|
||||||
|
} else {
|
||||||
|
uni.setNavigationBarTitle({ title: navibarTitle })
|
||||||
|
}
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// navibarTitle 也会被用于浏览器的标签标题,因此要用 document.title 去覆盖。
|
// navibarTitle 也会被用于浏览器的标签标题,因此要用 document.title 去覆盖。
|
||||||
// 必须放在 setNavigationBarTitle 之后。
|
// 必须放在 setNavigationBarTitle 之后。但这个方案,在电脑上,还是会显示 navibarTitle 在浏览器窗口顶栏,不知为何。
|
||||||
document.title = `${windowTitle ||
|
// document.title =
|
||||||
wo?.envar?.callname?.[mylang] ||
|
// windowTitle ||
|
||||||
pagesJson?.appInfo?.i18nText?.[mylang] ||
|
// wo?.envar?.callname?.[mylang] ||
|
||||||
pagesJson?.globalStyle?.navigationBarTitleText} - ${navibarTitle}`
|
// pagesJson?.appInfo?.i18nText?.[mylang] ||
|
||||||
|
// pagesJson?.globalStyle?.navigationBarTitleText ||
|
||||||
|
// '' + (navibarTitle ? ` - ${navibarTitle}` : '')
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 必须要在有 tab 的页面里 setTabBarItem 才有效果
|
// 必须要在有 tab 的页面里 setTabBarItem 才有效果
|
||||||
|
Loading…
Reference in New Issue
Block a user