Commit b410c9e7 authored by youjie's avatar youjie

no message

parent f1f10443
import enUS from './en-US'
import zhTW from './zh-TW'
import zhSW from './zh-SW'
export default {
'en-US': enUS,
'zh-TW': zhTW
'zh-TW': zhTW,
'zh-SW': zhSW,
}
......@@ -97,6 +97,7 @@
option-value="langLocale"
option-label="langName"
style="width:180px"
@update:model-value="getLanguage"
>
<template v-slot:selected>
{{$t("lanuage")}}
......@@ -119,12 +120,12 @@
</template>
<script lang="ts">
import { defineComponent, reactive } from 'vue'
import { defineComponent, reactive, ref } from 'vue'
import useLgoinModule from '../../module/user/loginModule'
import useMetaModule from '../../module/meta/metaModule'
import { useI18n } from 'vue-i18n'
import { getLangs } from "../../utils/tools";
import { SitLang } from '../../@types/index';
import { SitLang } from '../../@types';
import {ref } from 'vue';
export default defineComponent({
setup() {
......@@ -143,8 +144,13 @@ export default defineComponent({
if(data.langs && data.langs.length>0){
data.currentLang = data.langs.find(x=> x.langLocale==locale.value) ?? {};
}
// 切换语言
const getLanguage = (val) => {
locale.value = val.langLocale;
}
return { userModel, usernameRef, passwordRef, userValidateRule, loginSubmit, dtNow, stateManager,...data}
return { userModel, usernameRef, passwordRef, userValidateRule, loginSubmit, dtNow, stateManager,getLanguage,...data}
}
})
</script>
......
......@@ -36,7 +36,15 @@ export function getLangs() {
langLocale:"zh-TW",
langName:"中文繁体"
}
const zhSw:SitLang={
langLocale:"zh-SW",
langName:"中文简体"
}
const enUs:SitLang={
langLocale:"en-US",
langName:"English"
}
let langs:SitLang[]=[]
langs.push(zhTw);
langs.push(zhTw,zhSw,enUs);
return langs
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment