diff --git a/src/App.vue b/src/App.vue index c97bbce..37b3a50 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,6 +10,7 @@ import { useI18n } from 'vue-i18n' import { enableI18n } from '@/config' import type { Locale } from 'ant-design-vue/es/locale-provider' import type { Ref } from 'vue' +import dayjs from 'dayjs' let antdLocal: Ref @@ -19,5 +20,13 @@ if (enableI18n) { antdLocal = computed(() => { return i18n.getLocaleMessage(i18nStore.language)?.antdLocale as Locale }) +} else { + // 未开启国际化,默认使用中文 + const modules = import.meta.glob('@/locales/lang/default-local-import.ts', { eager: true }) + for (const path in modules) { + // @ts-ignore + antdLocal = modules[path].default + } + dayjs.locale('zh-cn') } diff --git a/src/locales/lang/default-local-import.ts b/src/locales/lang/default-local-import.ts new file mode 100644 index 0000000..d15b5a0 --- /dev/null +++ b/src/locales/lang/default-local-import.ts @@ -0,0 +1,4 @@ +import localeValues from 'ant-design-vue/es/locale/zh_CN' +import 'dayjs/locale/zh-cn' + +export default localeValues