fix: 完善平台国际化覆盖

This commit is contained in:
Nixevol
2026-07-05 00:53:03 +08:00
parent 66d16a6524
commit 4d32a117e2
16 changed files with 295 additions and 111 deletions
+14 -2
View File
@@ -1,9 +1,21 @@
import { createDiscreteApi } from 'naive-ui';
import { computed } from 'vue';
import { createDiscreteApi, darkTheme, dateEnUS, dateZhCN, enUS, zhCN } from 'naive-ui';
import { i18n } from '@/locales';
import { themeOverrides } from '@/theme';
import { useTheme } from '@/composables/useTheme';
// 全局可用的消息/对话框/加载条(含在 setup 之外,如 axios 拦截器)
const { isDark } = useTheme();
const { message, dialog, loadingBar } = createDiscreteApi(['message', 'dialog', 'loadingBar'], {
configProviderProps: { themeOverrides },
configProviderProps: computed(() => {
const isEnglish = i18n.global.locale.value === 'en-US';
return {
theme: isDark.value ? darkTheme : null,
themeOverrides,
locale: isEnglish ? enUS : zhCN,
dateLocale: isEnglish ? dateEnUS : dateZhCN,
};
}),
});
export { message, dialog, loadingBar };