<template>
|
<transition name="el-fade-in-linear">
|
<router-view/>
|
</transition>
|
</template>
|
|
<script>
|
import Cookies from 'js-cookie'
|
import {messages} from '../packages/i18n'
|
|
export default {
|
watch: {
|
'$i18n.locale': 'i18nHandle'
|
},
|
created() {
|
this.i18nHandle(this.$i18n.locale)
|
|
let body = document.querySelector('body')
|
|
body.className += ' '+ this.$store.state.theme
|
},
|
methods: {
|
i18nHandle(val, oldVal) {
|
Cookies.set('language', val)
|
document.querySelector('html').setAttribute('lang', val)
|
|
// 可以在这里修改国际化显示名称
|
messages[val].brand.lg = '测试过程管理平台'
|
messages[val].company.name = '单位名称'
|
messages[val].company.code = '单位代码'
|
messages[val].company.shortName = '单位简称'
|
messages[val].company.type = '单位类型'
|
messages[val].company.sort = '排序'
|
messages[val].company.parentCompany = '上级单位'
|
|
document.title = messages[val].brand.lg
|
// 非登录页面,切换语言刷新页面
|
if (this.$route.name !== 'login' && oldVal) {
|
window.location.reload()
|
}
|
}
|
}
|
}
|
</script>
|
<style>
|
/*.el-table .cell{*/
|
/*white-space: inherit;*/
|
/*}*/
|
</style>
|