Commit 2e4f4cc2 authored by chenqikuai's avatar chenqikuai

fix: 修复document.title随着语言的切换没有变化的bug

parent afbbc324
...@@ -38,8 +38,10 @@ export default Vue.extend({ ...@@ -38,8 +38,10 @@ export default Vue.extend({
this.$emit('hidden', true) this.$emit('hidden', true)
window.sessionStorage.setItem('language', v) window.sessionStorage.setItem('language', v)
this.$i18n.locale = v === 'zh-CN' ? 'zh' : 'en' this.$i18n.locale = v === 'zh-CN' ? 'zh' : 'en'
document.title = `${this.$t('lang.YUANLIAN')}YCC——${this.$t(
'lang.title',
)}`
moment.locale(v === 'zh-CN' ? 'zh-cn' : 'en') moment.locale(v === 'zh-CN' ? 'zh-cn' : 'en')
console.log({...this.$route.query, lang: v})
this.$router.replace({ path: this.$route.path, query: { ...this.$route.query, lang: v }}) this.$router.replace({ path: this.$route.path, query: { ...this.$route.query, lang: v }})
} }
}, },
......
...@@ -272,6 +272,9 @@ export default Vue.extend({ ...@@ -272,6 +272,9 @@ export default Vue.extend({
this.isTop = scrollY < 70 ? true : false this.isTop = scrollY < 70 ? true : false
}) })
moment.locale(this.iconType === 'zh-CN' ? 'zh-cn' : 'en') moment.locale(this.iconType === 'zh-CN' ? 'zh-cn' : 'en')
document.title = `${this.$t('lang.YUANLIAN')}YCC——${this.$t(
'lang.title',
)}`
}, },
watch: { watch: {
$route(n, o) { $route(n, o) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment