西藏巴青项目

tabPage.js 710B

12345678910111213141516171819202122232425262728293031323334
  1. import { syncTabBarText } from '@/utils/tabBar'
  2. /**
  3. * Tab 子页共用:根节点语言 class、导航标题、底部 tab 文案与 i18n 同步
  4. * 页面需在 data 中提供 navTitleKey,如 'nav.home'
  5. */
  6. export default {
  7. data() {
  8. return {
  9. layoutKey: 0
  10. }
  11. },
  12. computed: {
  13. lang() {
  14. return this.$i18n.locale
  15. },
  16. pageRootClass() {
  17. return this.lang === 'bo' ? 'lang-bo' : 'lang-zh'
  18. }
  19. },
  20. onShow() {
  21. syncTabBarText((k) => this.$t(k))
  22. const key = this.navTitleKey
  23. if (key) {
  24. const p = uni.setNavigationBarTitle({
  25. title: this.$t(key)
  26. })
  27. if (p && typeof p.catch === 'function') {
  28. p.catch(() => {})
  29. }
  30. }
  31. }
  32. }