feat: arco国际化
This commit is contained in:
parent
b128655b56
commit
1e73b1fc5e
16
src/App.vue
16
src/App.vue
@ -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
1
src/components.d.ts
vendored
@ -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']
|
||||
|
||||
25
src/components/lang-provider/index.vue
Normal file
25
src/components/lang-provider/index.vue
Normal 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>
|
||||
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<component :is="layouts['defaults']"></component>
|
||||
<lang-provider>
|
||||
<component :is="layouts['defaults']" />
|
||||
</lang-provider>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>表单数据</div>
|
||||
<div>表单数据<a-date-picker style="width: 200px" /></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user