|
@@ -1,9 +1,11 @@
|
|
|
<template>
|
|
|
<el-dropdown type="primary" @command="handleCommand">
|
|
|
- <div class="lang-change-btn">
|
|
|
- <SvgIcon icon-class="earth" class-name="earth"></SvgIcon>
|
|
|
+ <div v-if="size === 'large'" class="lang-change-btn">
|
|
|
+ <img style="width: 24px; height: 24px" src="@/assets/earth.png" alt="" />
|
|
|
+ <SvgIcon icon-class="earth" class-name="svg-icon-earth"></SvgIcon>
|
|
|
{{ curLang }}
|
|
|
</div>
|
|
|
+ <img v-else style="width: 20px; height: 20px" src="@/assets/earth.png" alt="" />
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item v-for="lang in langs" :key="lang.value" :command="lang.value">
|
|
|
{{ lang.text }}
|
|
@@ -21,6 +23,12 @@ export default {
|
|
|
components: {
|
|
|
SvgIcon,
|
|
|
},
|
|
|
+ props: {
|
|
|
+ size: {
|
|
|
+ type: String,
|
|
|
+ default: 'large',
|
|
|
+ },
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
langs: [
|
|
@@ -45,7 +53,8 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
curLang() {
|
|
|
- return localStorage.getItem('lang') || 'zh-CN'
|
|
|
+ const curVal = localStorage.getItem('lang') || 'zh-CN'
|
|
|
+ return this.langs.find(({ value }) => value === curVal).text
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
@@ -73,14 +82,8 @@ export default {
|
|
|
height: 54px;
|
|
|
padding: 0px 16px;
|
|
|
align-items: center;
|
|
|
-
|
|
|
flex-shrink: 0;
|
|
|
border-radius: 8px;
|
|
|
border: 1px solid var(--e-6-e-6-e-6, #e6e6e6);
|
|
|
}
|
|
|
-
|
|
|
-.svg-icon-earth {
|
|
|
- width: 24px;
|
|
|
- height: 24px;
|
|
|
-}
|
|
|
</style>
|