mt-yd-ui/src/App.vue

35 lines
687 B
Vue
Raw Normal View History

2022-08-02 08:48:23 +08:00
<template>
2022-08-04 16:13:20 +08:00
<transition name="el-fade-in-linear">
<router-view />
</transition>
2022-08-02 08:48:23 +08:00
</template>
<style>
2022-08-04 16:13:20 +08:00
.el-table th.gutter {
display: table-cell !important;
}
2022-08-02 08:48:23 +08:00
</style>
<script>
import Cookies from 'js-cookie'
import { messages } from '@/i18n'
export default {
2022-08-04 16:13:20 +08:00
watch: {
'$i18n.locale': 'i18nHandle'
},
created() {
this.i18nHandle(this.$i18n.locale)
},
methods: {
i18nHandle(val, 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()
}
}
}
2022-08-02 08:48:23 +08:00
}
</script>