fix[i18n]: Change title when switching language

This commit is contained in:
albert 2020-09-03 10:36:29 +08:00
parent f55dd06f5a
commit 416177cf6b
1 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,7 @@
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import { getLanguage } from '@/lang/index' import { getLanguage } from '@/lang/index'
import router from '@/router'
import getPageTitle from '@/utils/get-page-title'
const state = { const state = {
sidebar: { sidebar: {
@ -30,6 +32,7 @@ const mutations = {
state.device = device state.device = device
}, },
SET_LANGUAGE: (state, language) => { SET_LANGUAGE: (state, language) => {
document.title = getPageTitle(router.currentRoute.meta.title)
state.language = language state.language = language
Cookies.set('language', language) Cookies.set('language', language)
}, },