feat: arco国际化

This commit is contained in:
wf 2024-04-26 12:59:43 +08:00
parent b128655b56
commit 1e73b1fc5e
5 changed files with 39 additions and 9 deletions

View File

@ -1,7 +1,9 @@
<template>
<div><router-view /></div>
</template>
<script setup></script>
<style lang="scss" scoped></style>
<template>
<div>
<router-view />
</div>
</template>
<script setup></script>
<style lang="scss" scoped></style>

1
src/components.d.ts vendored
View File

@ -7,6 +7,7 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
LangProvider: typeof import('./components/lang-provider/index.vue')['default']
MainTransition: typeof import('./components/main-transition/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']

View File

@ -0,0 +1,25 @@
<template>
<div>
<a-config-provider :locale="locale">
<slot></slot>
</a-config-provider>
</div>
</template>
<script setup lang="ts">
import zhCN from "@arco-design/web-vue/es/locale/lang/zh-cn";
import enUS from "@arco-design/web-vue/es/locale/lang/en-us";
interface Lang {
[key: string]: any;
}
const locales = ref<Lang>({
"zh-CN": zhCN,
"en-US": enUS
});
const localeType = ref<string>("zh-CN");
const locale = computed(() => {
return locales.value[localeType.value] || zhCN;
});
</script>
<style lang="scss" scoped></style>

View File

@ -1,6 +1,8 @@
<template>
<div>
<component :is="layouts['defaults']"></component>
<lang-provider>
<component :is="layouts['defaults']" />
</lang-provider>
</div>
</template>

View File

@ -1,6 +1,6 @@
<template>
<div>
<div>表单数据</div>
<div>表单数据<a-date-picker style="width: 200px" /></div>
</div>
</template>