多语言切换icon及切换方式代码调整

This commit is contained in:
renpy 2023-08-23 10:02:52 +08:00
parent 60f1f0dde4
commit d4f1f15491
3 changed files with 26 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View File

@ -1,7 +1,11 @@
<template>
<div class="user-wrapper" :class="theme">
<span @click="changeLang('zh-CN')">zh</span>
<span style="margin-left: 10px;" @click="changeLang('en-US')">en</span>
<span class="language" @click="changeLang">
<img :src="$i18n.locale=='zh-CN'?langIcon_en:langIcon_zh" alt="">
<!-- <img :src=langIcon_zh alt=""> -->
</span>
<!-- <span @click="changeLang('zh-CN')">zh</span>
<span style="margin-left: 10px;" @click="changeLang('en-US')">en</span> -->
<header-notice class="action"/>
<a-dropdown>
<span class="action action-full ant-dropdown-link user-dropdown-menu">
@ -65,7 +69,9 @@ import i18nMixin from '@/store/i18n-mixin'
name: "UserMenu",
mixins: [mixinDevice,i18nMixin],
data(){
return{
return {
langIcon_zh:require('@/assets/images/header/zh.png'),
langIcon_en:require('@/assets/images/header/en.png'),
// update-begin author:sunjianlei date:20200219 for: --------------
searchMenuOptions:[],
searchMenuComp: 'span',
@ -90,9 +96,10 @@ import i18nMixin from '@/store/i18n-mixin'
created() {
let lists = []
this.searchMenus(lists,this.permissionMenuList)
this.searchMenuOptions=[...lists]
this.searchMenuOptions = [...lists]
},
mounted() {
console.log(this.$i18n.locale);
//
if (process.env.VUE_APP_SSO == 'true') {
let depart = this.userInfo().orgCode
@ -121,9 +128,10 @@ import i18nMixin from '@/store/i18n-mixin'
// update-end author:sunjianlei date:20200219 for:
},
methods: {
changeLang(key) {
this.$i18n.locale = key
this.setLang(key)
changeLang() {
let lang = this.$i18n.locale == "zh-CN" ? "en-US" : "zh-CN"
this.$i18n.locale = lang
this.setLang(lang)
},
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
showClick() {
@ -243,6 +251,17 @@ import i18nMixin from '@/store/i18n-mixin'
}
}
}
.language{
display: inline-block;
width: 21px;
height: 21px;
cursor: pointer;
margin-right: 5px;
img{
width: 100%;
height: 100%;
}
}
/* update-end author:sunjianlei date:20191220 for: 解决全局样式冲突问题 */
/* update_end author:zhaoxin date:20191129 for: 让搜索框颜色能随主题颜色变换*/
</style>