新增.gitignore文件以忽略以.aider开头的文件,更新API逻辑以使用全局配置获取OSS相关信息,优化上传组件中的配置获取方式,同时更新依赖项的版本以确保兼容性。
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { GlobalConfig } from '../share/types.ts';
|
||||
|
||||
export function getEnumOptions<T extends string | number, M extends Record<T, string>>(enumObj: Record<string, T>, nameMap: M) {
|
||||
return Object.entries(enumObj)
|
||||
.filter(([_key, value]) => !isNaN(Number(value)) || typeof value === 'string') // 保留数字和字符串类型的值
|
||||
@@ -6,4 +8,13 @@ export function getEnumOptions<T extends string | number, M extends Record<T, st
|
||||
label: nameMap[value as T],
|
||||
value: value
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局配置项 (严格类型版本)
|
||||
* @param key 配置键名
|
||||
* @returns 配置值或undefined
|
||||
*/
|
||||
export function getGlobalConfig<T extends keyof GlobalConfig>(key: T): GlobalConfig[T] | undefined {
|
||||
return (window as typeof window & { CONFIG?: GlobalConfig }).CONFIG?.[key];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user