多语言切换icon及切换方式代码调整
This commit is contained in:
parent
60f1f0dde4
commit
d4f1f15491
BIN
src/assets/images/header/en.png
Normal file
BIN
src/assets/images/header/en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 522 B |
BIN
src/assets/images/header/zh.png
Normal file
BIN
src/assets/images/header/zh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 446 B |
|
@ -1,7 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="user-wrapper" :class="theme">
|
<div class="user-wrapper" :class="theme">
|
||||||
<span @click="changeLang('zh-CN')">zh</span>
|
<span class="language" @click="changeLang">
|
||||||
<span style="margin-left: 10px;" @click="changeLang('en-US')">en</span>
|
<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"/>
|
<header-notice class="action"/>
|
||||||
<a-dropdown>
|
<a-dropdown>
|
||||||
<span class="action action-full ant-dropdown-link user-dropdown-menu">
|
<span class="action action-full ant-dropdown-link user-dropdown-menu">
|
||||||
|
@ -66,6 +70,8 @@ import i18nMixin from '@/store/i18n-mixin'
|
||||||
mixins: [mixinDevice,i18nMixin],
|
mixins: [mixinDevice,i18nMixin],
|
||||||
data(){
|
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: 头部菜单搜索规范命名 --------------
|
// update-begin author:sunjianlei date:20200219 for: 头部菜单搜索规范命名 --------------
|
||||||
searchMenuOptions:[],
|
searchMenuOptions:[],
|
||||||
searchMenuComp: 'span',
|
searchMenuComp: 'span',
|
||||||
|
@ -93,6 +99,7 @@ import i18nMixin from '@/store/i18n-mixin'
|
||||||
this.searchMenuOptions = [...lists]
|
this.searchMenuOptions = [...lists]
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
console.log(this.$i18n.locale);
|
||||||
//如果是单点登录模式
|
//如果是单点登录模式
|
||||||
if (process.env.VUE_APP_SSO == 'true') {
|
if (process.env.VUE_APP_SSO == 'true') {
|
||||||
let depart = this.userInfo().orgCode
|
let depart = this.userInfo().orgCode
|
||||||
|
@ -121,9 +128,10 @@ import i18nMixin from '@/store/i18n-mixin'
|
||||||
// update-end author:sunjianlei date:20200219 for: 菜单搜索改为动态组件,在手机端呈现出弹出框
|
// update-end author:sunjianlei date:20200219 for: 菜单搜索改为动态组件,在手机端呈现出弹出框
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeLang(key) {
|
changeLang() {
|
||||||
this.$i18n.locale = key
|
let lang = this.$i18n.locale == "zh-CN" ? "en-US" : "zh-CN"
|
||||||
this.setLang(key)
|
this.$i18n.locale = lang
|
||||||
|
this.setLang(lang)
|
||||||
},
|
},
|
||||||
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||||
showClick() {
|
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:sunjianlei date:20191220 for: 解决全局样式冲突问题 */
|
||||||
/* update_end author:zhaoxin date:20191129 for: 让搜索框颜色能随主题颜色变换*/
|
/* update_end author:zhaoxin date:20191129 for: 让搜索框颜色能随主题颜色变换*/
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user