Browse Source

feat: 使用vue-i18n插件,初步完成中英泰的字段切换,全局生效

zhangrenyuan/feature-20251125114759-多语言
zhangrenyuan 4 days ago
parent
commit
964fc7d8b4
  1. 82
      package-lock.json
  2. 1
      package.json
  3. 29
      src/App.vue
  4. 118
      src/components/dialogs/LanguageSwitch.vue
  5. 28
      src/components/locales/index.js
  6. 10
      src/components/locales/lang/en.js
  7. 10
      src/components/locales/lang/th.js
  8. 10
      src/components/locales/lang/zh-CN.js
  9. 3
      src/main.ts
  10. 3
      src/views/audit/gold/audit.vue
  11. 19
      src/views/home.vue

82
package-lock.json

@ -27,6 +27,7 @@
"pinia": "^3.0.2", "pinia": "^3.0.2",
"pinyin-match": "^1.2.8", "pinyin-match": "^1.2.8",
"vue": "^3.5.12", "vue": "^3.5.12",
"vue-i18n": "^9.14.5",
"vue-icons-plus": "^0.1.7", "vue-icons-plus": "^0.1.7",
"vue-json-excel": "^0.3.0", "vue-json-excel": "^0.3.0",
"vue-router": "^4.5.0", "vue-router": "^4.5.0",
@ -115,6 +116,7 @@
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz",
"integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==",
"dev": true, "dev": true,
"peer": true,
"dependencies": { "dependencies": {
"@ampproject/remapping": "^2.2.0", "@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.26.2", "@babel/code-frame": "^7.26.2",
@ -2018,6 +2020,7 @@
"version": "6.7.2", "version": "6.7.2",
"resolved": "https://registry.npmmirror.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.7.2.tgz", "resolved": "https://registry.npmmirror.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.7.2.tgz",
"integrity": "sha512-yxtOBWDrdi5DD5o1pmVdq3WMCvnobT0LU6R8RyyVXPvFRd2o79/0NCuQoCjNTeZz9EzA9xS3JxNWfv54RIHFEA==", "integrity": "sha512-yxtOBWDrdi5DD5o1pmVdq3WMCvnobT0LU6R8RyyVXPvFRd2o79/0NCuQoCjNTeZz9EzA9xS3JxNWfv54RIHFEA==",
"peer": true,
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-common-types": "6.7.2" "@fortawesome/fontawesome-common-types": "6.7.2"
}, },
@ -2045,6 +2048,50 @@
"vue": ">= 3.0.0 < 4" "vue": ">= 3.0.0 < 4"
} }
}, },
"node_modules/@intlify/core-base": {
"version": "9.14.5",
"resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.14.5.tgz",
"integrity": "sha512-5ah5FqZG4pOoHjkvs8mjtv+gPKYU0zCISaYNjBNNqYiaITxW8ZtVih3GS/oTOqN8d9/mDLyrjD46GBApNxmlsA==",
"license": "MIT",
"dependencies": {
"@intlify/message-compiler": "9.14.5",
"@intlify/shared": "9.14.5"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@intlify/message-compiler": {
"version": "9.14.5",
"resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.14.5.tgz",
"integrity": "sha512-IHzgEu61/YIpQV5Pc3aRWScDcnFKWvQA9kigcINcCBXN8mbW+vk9SK+lDxA6STzKQsVJxUPg9ACC52pKKo3SVQ==",
"license": "MIT",
"dependencies": {
"@intlify/shared": "9.14.5",
"source-map-js": "^1.0.2"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@intlify/shared": {
"version": "9.14.5",
"resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.14.5.tgz",
"integrity": "sha512-9gB+E53BYuAEMhbCAxVgG38EZrk59sxBtv3jSizNL2hEWlgjBjAw1AwpLHtNaeda12pe6W20OGEa0TwuMSRbyQ==",
"license": "MIT",
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
"version": "0.3.8", "version": "0.3.8",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", "resolved": "https://mirrors.huaweicloud.com/repository/npm/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
@ -2746,6 +2793,7 @@
"resolved": "https://mirrors.huaweicloud.com/repository/npm/@types/lodash-es/-/lodash-es-4.17.12.tgz", "resolved": "https://mirrors.huaweicloud.com/repository/npm/@types/lodash-es/-/lodash-es-4.17.12.tgz",
"integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@types/lodash": "*" "@types/lodash": "*"
} }
@ -2756,6 +2804,7 @@
"integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==", "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"undici-types": "~6.20.0" "undici-types": "~6.20.0"
} }
@ -3292,6 +3341,7 @@
} }
], ],
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"caniuse-lite": "^1.0.30001688", "caniuse-lite": "^1.0.30001688",
"electron-to-chromium": "^1.5.73", "electron-to-chromium": "^1.5.73",
@ -4196,13 +4246,15 @@
"version": "4.17.21", "version": "4.17.21",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/lodash/-/lodash-4.17.21.tgz", "resolved": "https://mirrors.huaweicloud.com/repository/npm/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"license": "MIT"
"license": "MIT",
"peer": true
}, },
"node_modules/lodash-es": { "node_modules/lodash-es": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/lodash-es/-/lodash-es-4.17.21.tgz", "resolved": "https://mirrors.huaweicloud.com/repository/npm/lodash-es/-/lodash-es-4.17.21.tgz",
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
"license": "MIT"
"license": "MIT",
"peer": true
}, },
"node_modules/lodash-unified": { "node_modules/lodash-unified": {
"version": "1.0.3", "version": "1.0.3",
@ -4672,6 +4724,7 @@
"integrity": "sha512-wc2cBWqJgkU3Iz5oztRkQbfVkbxoz5EhnCGOrnJvnLnQ7O0WhQUYyv18qQI79O8L7DdHrrlJNeCHd4VGpnaXKQ==", "integrity": "sha512-wc2cBWqJgkU3Iz5oztRkQbfVkbxoz5EhnCGOrnJvnLnQ7O0WhQUYyv18qQI79O8L7DdHrrlJNeCHd4VGpnaXKQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@types/estree": "1.0.6" "@types/estree": "1.0.6"
}, },
@ -4749,6 +4802,7 @@
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.86.3.tgz", "resolved": "https://registry.npmmirror.com/sass/-/sass-1.86.3.tgz",
"integrity": "sha512-iGtg8kus4GrsGLRDLRBRHY9dNVA78ZaS7xr01cWnS7PEMQyFtTqBiyCrfpTYTZXRWM94akzckYjh8oADfFNTzw==", "integrity": "sha512-iGtg8kus4GrsGLRDLRBRHY9dNVA78ZaS7xr01cWnS7PEMQyFtTqBiyCrfpTYTZXRWM94akzckYjh8oADfFNTzw==",
"dev": true, "dev": true,
"peer": true,
"dependencies": { "dependencies": {
"chokidar": "^4.0.0", "chokidar": "^4.0.0",
"immutable": "^5.0.2", "immutable": "^5.0.2",
@ -4895,6 +4949,7 @@
"integrity": "sha512-GWANVlPM/ZfYzuPHjq0nxT+EbOEDDN3Jwhwdg1D8TU8oSkktp8w64Uq4auuGLxFSoNTRDncTq2hQHX1Ld9KHkA==", "integrity": "sha512-GWANVlPM/ZfYzuPHjq0nxT+EbOEDDN3Jwhwdg1D8TU8oSkktp8w64Uq4auuGLxFSoNTRDncTq2hQHX1Ld9KHkA==",
"dev": true, "dev": true,
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"peer": true,
"dependencies": { "dependencies": {
"@jridgewell/source-map": "^0.3.3", "@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2", "acorn": "^8.8.2",
@ -4948,6 +5003,7 @@
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
"devOptional": true, "devOptional": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"peer": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
@ -5040,6 +5096,7 @@
"integrity": "sha512-RjjMipCKVoR4hVfPY6GQTgveinjNuyLw+qruksLDvA5ktI1150VmcMBKmQaEWJhg/j6Uaf6dNCNA0AfdzUb/hQ==", "integrity": "sha512-RjjMipCKVoR4hVfPY6GQTgveinjNuyLw+qruksLDvA5ktI1150VmcMBKmQaEWJhg/j6Uaf6dNCNA0AfdzUb/hQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"esbuild": "^0.24.2", "esbuild": "^0.24.2",
"postcss": "^8.5.1", "postcss": "^8.5.1",
@ -5131,6 +5188,7 @@
"resolved": "https://mirrors.huaweicloud.com/repository/npm/vue/-/vue-3.5.13.tgz", "resolved": "https://mirrors.huaweicloud.com/repository/npm/vue/-/vue-3.5.13.tgz",
"integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==", "integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.5.13", "@vue/compiler-dom": "3.5.13",
"@vue/compiler-sfc": "3.5.13", "@vue/compiler-sfc": "3.5.13",
@ -5147,6 +5205,26 @@
} }
} }
}, },
"node_modules/vue-i18n": {
"version": "9.14.5",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.14.5.tgz",
"integrity": "sha512-0jQ9Em3ymWngyiIkj0+c/k7WgaPO+TNzjKSNq9BvBQaKJECqn9cd9fL4tkDhB5G1QBskGl9YxxbDAhgbFtpe2g==",
"license": "MIT",
"dependencies": {
"@intlify/core-base": "9.14.5",
"@intlify/shared": "9.14.5",
"@vue/devtools-api": "^6.5.0"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
},
"peerDependencies": {
"vue": "^3.0.0"
}
},
"node_modules/vue-icons-plus": { "node_modules/vue-icons-plus": {
"version": "0.1.7", "version": "0.1.7",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/vue-icons-plus/-/vue-icons-plus-0.1.7.tgz", "resolved": "https://mirrors.huaweicloud.com/repository/npm/vue-icons-plus/-/vue-icons-plus-0.1.7.tgz",

1
package.json

@ -31,6 +31,7 @@
"pinia": "^3.0.2", "pinia": "^3.0.2",
"pinyin-match": "^1.2.8", "pinyin-match": "^1.2.8",
"vue": "^3.5.12", "vue": "^3.5.12",
"vue-i18n": "^9.14.5",
"vue-icons-plus": "^0.1.7", "vue-icons-plus": "^0.1.7",
"vue-json-excel": "^0.3.0", "vue-json-excel": "^0.3.0",
"vue-router": "^4.5.0", "vue-router": "^4.5.0",

29
src/App.vue

@ -1,9 +1,26 @@
<script setup>
</script>
<template> <template>
<router-view></router-view>
<el-config-provider :locale="elLocale">
<router-view />
</el-config-provider>
</template> </template>
<style scoped>
</style>
<script setup>
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
// Element Plus
import zhCnLocale from 'element-plus/dist/locale/zh-cn.mjs'
import enLocale from 'element-plus/dist/locale/en.mjs'
import thLocale from 'element-plus/dist/locale/th.mjs'
const { locale } = useI18n()
// i18n Element Plus
const elLocale = computed(() => {
switch (locale.value) {
case 'zh-CN': return zhCnLocale
case 'en': return enLocale
case 'th': return thLocale
default: return zhCnLocale
}
})
</script>

118
src/components/dialogs/LanguageSwitch.vue

@ -0,0 +1,118 @@
<template>
<el-dialog
v-model="dialogVisible"
title="语言切换"
width="300px"
:close-on-click-modal="false"
append-to-body
>
<el-form label-width="80px">
<el-form-item label="当前语言">
<el-input
:model-value="getLangLabel(currentLang)"
disabled
/>
</el-form-item>
<el-form-item label="切换语言">
<el-select
v-model="tempLang"
placeholder="请选择语言"
style="width: 100%"
>
<el-option
v-for="item in langOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="handleConfirm"> </el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { ref, computed } from 'vue'
import { useI18n } from 'vue-i18n'
// === Element Plus ===
import {
ElDialog,
ElForm,
ElFormItem,
ElInput,
ElSelect,
ElOption,
ElButton,
ElMessage
} from 'element-plus'
//
// import 'element-plus/es/components/dialog/style/css'
// import 'element-plus/es/components/form/style/css'
// ...
const { locale } = useI18n()
//
const dialogVisible = ref(false)
//
const currentLang = computed(() => locale.value)
//
const tempLang = ref('')
//
const langOptions = [
{ label: '中文(简体)', value: 'zh-CN' },
{ label: '中文(繁体)', value: 'zh-TW' },
{ label: '英语', value: 'en' },
{ label: '泰语', value: 'th' },
{ label: '越南语', value: 'vi' }
]
//
const getLangLabel = (langCode) => {
const find = langOptions.find(item => item.value === langCode)
return find ? find.label : langCode
}
//
const open = () => {
tempLang.value = currentLang.value
dialogVisible.value = true
}
//
const handleConfirm = () => {
locale.value = tempLang.value
localStorage.setItem('language', tempLang.value)
ElMessage.success(`语言已切换为:${getLangLabel(tempLang.value)}`)
dialogVisible.value = false
}
defineExpose({
open
})
</script>
<!-- 去掉scoped全局生效 -->
<style >
.el-dialog__body {
height: 500px !important;
overflow-y: auto;
}
.dialog-footer {
display: flex;
justify-content: center;
gap: 20px;
}
</style>

28
src/components/locales/index.js

@ -0,0 +1,28 @@
import { createI18n } from 'vue-i18n'
// 引入你的本地语言包
import zhCN from './lang/zh-CN'
import en from './lang/en'
import th from './lang/th' // 泰文
// 组合语言包
const messages = {
'zh-CN': zhCN,
'en': en,
'th': th
}
// 获取浏览器默认语言或缓存语言
const getLocale = () => {
// 优先读取缓存,没有则读取浏览器语言,默认 zh-CN
return localStorage.getItem('language') || 'zh-CN'
}
const i18n = createI18n({
legacy: false, // Vue 3 组合式 API 必须设置为 false
globalInjection: true, // 全局注入 $t 函数
locale: getLocale(), // 初始化语言
messages // 语言包数据
})
export default i18n

10
src/components/locales/lang/en.js

@ -0,0 +1,10 @@
export default {
common: {
confirm: 'Confirm',
cancel: 'Cancel'
},
audit: {
rechargeAudit: 'Recharge Audit',
status: 'Status'
}
}

10
src/components/locales/lang/th.js

@ -0,0 +1,10 @@
export default {
common: {
confirm: 'ยืนยัน',
cancel: 'ยกเลิก'
},
audit: {
rechargeAudit: 'การตรวจสอบการเติมเงิน',
status: 'สถานะ'
}
}

10
src/components/locales/lang/zh-CN.js

@ -0,0 +1,10 @@
export default {
common: {
confirm: '确定',
cancel: '取消'
},
audit: {
rechargeAudit: '充值审核', // 你的需求字段
status: '状态'
}
}

3
src/main.ts

@ -18,6 +18,8 @@ import request from "@/util/request";
import "./global.css"; import "./global.css";
import '@/assets/css/btn.css'; import '@/assets/css/btn.css';
import {useMessageStore} from "@/store"; import {useMessageStore} from "@/store";
import i18n from './components/locales'
const app = createApp(App) const app = createApp(App)
@ -40,6 +42,7 @@ app.use(ElementPlus, {
.use(VxeUI) .use(VxeUI)
.use(VxeUITable) .use(VxeUITable)
.use(pinia) .use(pinia)
.use(i18n)
.mount('#app') .mount('#app')
// 在 app 挂载之后再使用 store // 在 app 挂载之后再使用 store

3
src/views/audit/gold/audit.vue

@ -8,7 +8,7 @@
@click="navigateTo('rechargeAudit')" @click="navigateTo('rechargeAudit')"
v-if="hasRecharge" v-if="hasRecharge"
> >
充值审核
{{ $t('audit.rechargeAudit') }}
</el-button> </el-button>
<el-button <el-button
class="no-active-btn" class="no-active-btn"
@ -31,6 +31,7 @@ import { storeToRefs } from 'pinia';
import { useAdminStore } from '@/store/index.js'; import { useAdminStore } from '@/store/index.js';
import { hasMenuPermission, permissionMapping } from "@/utils/menuTreePermission.js"; import { hasMenuPermission, permissionMapping } from "@/utils/menuTreePermission.js";
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { useI18n } from 'vue-i18n';
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();

19
src/views/home.vue

@ -3,6 +3,7 @@ import {computed, onMounted, ref} from 'vue'
import {useRoute, useRouter} from 'vue-router' import {useRoute, useRouter} from 'vue-router'
import {ElMessage} from 'element-plus' import {ElMessage} from 'element-plus'
import ChangePassword from '@/components/dialogs/changePassword.vue' import ChangePassword from '@/components/dialogs/changePassword.vue'
import LanguageSwitch from '@/components/dialogs/LanguageSwitch.vue' //
import {useAdminStore} from '@/store' import {useAdminStore} from '@/store'
import {storeToRefs} from 'pinia' import {storeToRefs} from 'pinia'
import {filterMenu, getRoutePath} from "@/utils/menuUtils.js"; import {filterMenu, getRoutePath} from "@/utils/menuUtils.js";
@ -47,6 +48,17 @@ const getIconPath = (menuName) => {
} }
} }
// ------------------ ------------------
const languageSwitchRef = ref()
const openLanguageSwitch = () => {
languageSwitchRef.value?.open()
}
const handleLanguageChanged = (lang) => {
ElMessage.success(`语言已切换到${lang}`)
}
// ------------------ ------------------ // ------------------ ------------------
const refreshData = async () => { const refreshData = async () => {
try { try {
@ -75,7 +87,6 @@ const adminStore = useAdminStore()
const {adminData, menuTree, flag} = storeToRefs(adminStore) const {adminData, menuTree, flag} = storeToRefs(adminStore)
const menuList = ref(filterMenu(menuTree.value)) const menuList = ref(filterMenu(menuTree.value))
function findBestMatch(menuList, path) { function findBestMatch(menuList, path) {
let bestMatch = '' let bestMatch = ''
@ -369,7 +380,7 @@ onMounted(() => getMessage())
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<!-- <el-dropdown-item @click="refreshData()">数据刷新</el-dropdown-item>--> <!-- <el-dropdown-item @click="refreshData()">数据刷新</el-dropdown-item>-->
<!-- 员工数据开关 -->
<el-dropdown-item @click="openLanguageSwitch">语言切换</el-dropdown-item>
<el-dropdown-item @click="toggleFlag()"> <el-dropdown-item @click="toggleFlag()">
{{ flag === 1 ? '显示员工数据' : '隐藏员工数据' }} {{ flag === 1 ? '显示员工数据' : '隐藏员工数据' }}
</el-dropdown-item> </el-dropdown-item>
@ -525,7 +536,9 @@ onMounted(() => getMessage())
</el-dialog> </el-dialog>
<!-- 语言切换弹窗 -->
<LanguageSwitch ref="languageSwitchRef" />
</div> </div>
</template> </template>

Loading…
Cancel
Save