qms/src/App.vue
2023-05-11 16:22:07 +08:00

45 lines
952 B
Vue

<!--
* @Author: zhp
* @Date: 2023-01-06 10:13:07
* @LastEditTime: 2023-04-04 10:12:00
* @LastEditors: zhp
* @Description:
-->
<template>
<transition name="el-fade-in-linear">
<router-view />
</transition>
</template>
<style>
.el-table th.gutter{
display: table-cell!important;
}
</style>
<script>
import Cookies from 'js-cookie'
import { messages } from '@/i18n'
export default {
watch: {
'$i18n.locale': 'i18nHandle'
},
created () {
this.i18nHandle(this.$i18n.locale)
},
methods: {
i18nHandle(val, oldVal) {
console.log(this.$i18n.locale);
console.log(val)
console.log(oldVal)
Cookies.set('language', val)
document.querySelector('html').setAttribute('lang', val)
document.title = messages[val].brand.lg
// 非登录页面,切换语言刷新页面
if (this.$route.name !== 'login' && oldVal) {
window.location.reload()
}
}
}
}
</script>