u
This commit is contained in:
parent
8515daf1bc
commit
8b1cd9ff6a
@ -18,7 +18,7 @@ export default {
|
||||
thisPage() {
|
||||
return this.__page__ ? this // 1) constructor.name==='VueComponent' 只在 development 环境有用,在 production 环境会被简化成 'o'。2)对于组件内定义的 i18nText,要使用 this 来获得组建内的 i18nText,而不是 getCurrentPages[...] 去访问全局页面的 i18nText。
|
||||
: ( getCurrentPages()[getCurrentPages().length - 1] // [20220401] 发现在 topWindow 里, getCurrentPages 是 undefined。
|
||||
|| {} ) // 用 {} 做备份是为了在 App.vue 中使用时,getCurrentPages() 有可能获取不到。
|
||||
|| {} ) // 在 App.vue 中调用 getCurrentPages() 返回的是空数组 [],因此在这里默认 {} 做保护。
|
||||
},
|
||||
|
||||
// 输出命令行提示,可用来取代 console.log/info/warn/error
|
||||
@ -60,8 +60,8 @@ export default {
|
||||
setBarTitles ({ windowTitle, pageTitle,
|
||||
pagesJson=this.pagesJson || wo?.pagesJson } = {}
|
||||
) {
|
||||
const mylang = getApp().$store.state.i18n.mylang
|
||||
const pageNow = getCurrentPages()[getCurrentPages().length - 1]
|
||||
const mylang = getApp()?.$store?.state?.i18n?.mylang // 不要用 pageNow.$store,防止在 App.vue 里无法获取当前页面。
|
||||
const pageNow = this.thisPage() // 需要兼顾在 App.vue 时无法获取当前页面的情况,因为如果在 topWindow 里调用本函数,getApp() 和 getCurrentPages()[getCurrentPages().length-1] 就是 undefined。
|
||||
|
||||
// #ifdef H5
|
||||
document.title = windowTitle || wo?.envar?.Sys_Brand_Name?.[mylang] || pagesJson?.appInfo?.i18nText?.[mylang] || pagesJson?.globalStyle?.navigationBarTitleText // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。
|
||||
@ -72,7 +72,7 @@ export default {
|
||||
pageTitle ||
|
||||
pageNow?.i18nText?.[mylang]?.tPageTitle || // 页面.vue 的 i18nText 对象
|
||||
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 的页面配置里
|
||||
})
|
||||
|
||||
// 必须要在有 tab 的页面里 setTabBarItem 才有效果
|
||||
|
Loading…
Reference in New Issue
Block a user