fix 80650

This commit is contained in:
赵霄
2024-01-15 10:36:13 +08:00
parent abe8230a96
commit 83dcd43936
3 changed files with 27 additions and 4 deletions
+13 -4
View File
@@ -23,6 +23,7 @@ import { Locale } from 'vant'
import zhCN from 'vant/es/locale/lang/zh-CN'
import enUS from 'vant/es/locale/lang/en-US'
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN'
import * as dd from 'dingtalk-jsapi' // 解决document.title
const ZH = 'zh-CN'
const EN = 'en-US'
@@ -41,10 +42,6 @@ export default {
Locale.use('zh-CN', zhCN)
this.$i18n.locale = ZH
},
mounted () {
// 修改顶部标题
document.title = this.pageTitle
},
computed: {
// 是否中文
isChinese () {
@@ -74,6 +71,11 @@ export default {
return !!this.$route.meta.isWhiteNavBar
}
},
watch: {
pageTitle (val) {
this.changeTitle(val)
}
},
methods: {
// 返回上一层
handleBack () {
@@ -92,6 +94,13 @@ export default {
Locale.use(targetLang, vantLang)
// 更新i18n语言
this.$i18n.locale = targetLang
},
changeTitle (title) {
if (window.navigator.userAgent.includes('DingTalk')) {
dd.biz.navigation.setTitle({ title })
} else {
document.title = title
}
}
}
}