zhengyiming
9 天以前 048626512af9e86b6280fbc2ecfff33edf8eee31
src/constants/app.ts
@@ -1 +1,20 @@
export const AppType = import.meta.env.VITE_AppType || 'other';
export class Platform {
  static OS = AppType;
  static isJX = Platform.OS === 'jx';
  static isTP = Platform.OS === 'tp';
  static select<T>(config: Partial<Record<typeof Platform.OS, T>>): T {
    return config[Platform.OS];
  }
  static selectWithBase<TBase extends object, T extends object>(
    base: TBase,
    config: Partial<Record<typeof Platform.OS, T>>
  ) {
    const osConfig = config[Platform.OS] || ({} as T);
    return { ...base, ...osConfig };
  }
}