2021-03-03 15:06:52 +08:00
|
|
|
<template>
|
2021-05-17 17:23:29 +08:00
|
|
|
<el-dropdown style="display: flex;align-items: center;" trigger="click" class="international" @command="handleSetLanguage">
|
2021-03-03 15:06:52 +08:00
|
|
|
<div>
|
2021-09-03 14:40:47 +08:00
|
|
|
<svg-icon :style="{color: topMenuTextColor}" class-name="international-icon" icon-class="language" />
|
2021-03-03 15:06:52 +08:00
|
|
|
</div>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-05-18 17:30:36 +08:00
|
|
|
<el-dropdown-item :disabled="language==='zh_CN'" command="zh_CN">
|
2021-06-23 17:19:26 +08:00
|
|
|
简体中文
|
2021-03-03 15:06:52 +08:00
|
|
|
</el-dropdown-item>
|
2021-05-18 17:30:36 +08:00
|
|
|
<el-dropdown-item :disabled="language==='zh_TW'" command="zh_TW">
|
2021-06-23 17:19:26 +08:00
|
|
|
繁体中文
|
2021-03-03 15:06:52 +08:00
|
|
|
</el-dropdown-item>
|
2021-05-18 17:30:36 +08:00
|
|
|
<el-dropdown-item :disabled="language==='en_US'" command="en_US">
|
2021-03-03 15:06:52 +08:00
|
|
|
English
|
|
|
|
</el-dropdown-item>
|
2021-03-08 11:57:18 +08:00
|
|
|
<!-- <el-dropdown-item :disabled="language==='es'" command="es">
|
2021-03-03 15:06:52 +08:00
|
|
|
Español
|
|
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item :disabled="language==='ja'" command="ja">
|
|
|
|
日本語
|
2021-03-08 11:57:18 +08:00
|
|
|
</el-dropdown-item> -->
|
2021-03-03 15:06:52 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-09-03 14:40:47 +08:00
|
|
|
import variables from '@/styles/variables.scss'
|
2021-03-03 15:06:52 +08:00
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
language() {
|
|
|
|
return this.$store.getters.language
|
2021-09-03 14:40:47 +08:00
|
|
|
},
|
|
|
|
variables() {
|
|
|
|
return variables
|
|
|
|
},
|
|
|
|
topMenuTextColor() {
|
|
|
|
if (this.$store.getters.uiInfo && this.$store.getters.uiInfo['ui.topMenuTextColor'] && this.$store.getters.uiInfo['ui.topMenuTextColor'].paramValue) { return this.$store.getters.uiInfo['ui.topMenuTextColor'].paramValue }
|
|
|
|
return this.variables.topBarMenuText
|
2021-03-03 15:06:52 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleSetLanguage(lang) {
|
|
|
|
this.$i18n.locale = lang
|
2021-05-18 15:46:14 +08:00
|
|
|
this.$store.dispatch('user/setLanguage', lang)
|
2021-03-03 15:06:52 +08:00
|
|
|
this.$message({
|
2021-06-23 17:19:26 +08:00
|
|
|
message: this.$t('commons.switch_lang'),
|
2021-03-03 15:06:52 +08:00
|
|
|
type: 'success'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|