style: 调整代码格式

- 根据ESLint文件规范格式化app文件夹中的代码
This commit is contained in:
2025-09-15 17:02:04 +08:00
parent 67794e9523
commit 92c5a3baab
31 changed files with 1542 additions and 1321 deletions

View File

@ -1,39 +1,40 @@
import type { StrapiLocale } from '@nuxtjs/strapi';
import type { Language as ElementLanguage } from 'element-plus/es/locale';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import en from 'element-plus/es/locale/lang/en';
import type { StrapiLocale } from "@nuxtjs/strapi";
import type { Language as ElementLanguage } from "element-plus/es/locale";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import en from "element-plus/es/locale/lang/en";
// Strapi本地化映射
export const strapiLocales: Record<string, StrapiLocale> = {
'zh': 'zh-CN',
'en': 'en'
}
zh: "zh-CN",
en: "en",
};
// Element Plus本地化映射
export const elementPlusLocales: Record<string, ElementLanguage> = {
'zh': zhCn,
'en': en
}
zh: zhCn,
en: en,
};
export const useLocalizations = () => {
const { locale } = useI18n();
const { locale } = useI18n();
// 获取Strapi本地化代码
const getStrapiLocale = (nuxtLocale?: string): StrapiLocale => {
const currentLocale = nuxtLocale || locale.value;
return strapiLocales[currentLocale] || 'zh-Hans';
}
// 获取Strapi本地化代码
const getStrapiLocale = (nuxtLocale?: string): StrapiLocale => {
const currentLocale = nuxtLocale || locale.value;
return strapiLocales[currentLocale] || "zh-Hans";
};
// 获取Element Plus本地化
const getElementPlusLocale = (nuxtLocale?: string) => {
const currentLocale = nuxtLocale || locale.value;
const elementPlusLocale = elementPlusLocales[currentLocale] || elementPlusLocales['zh'];
return elementPlusLocale;
}
// 获取Element Plus本地化
const getElementPlusLocale = (nuxtLocale?: string) => {
const currentLocale = nuxtLocale || locale.value;
const elementPlusLocale =
elementPlusLocales[currentLocale] || elementPlusLocales["zh"];
return elementPlusLocale;
};
return {
locale: readonly(locale),
getStrapiLocale,
getElementPlusLocale,
}
}
return {
locale: readonly(locale),
getStrapiLocale,
getElementPlusLocale,
};
};