zhengyiming
9 天以前 048626512af9e86b6280fbc2ecfff33edf8eee31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 };
  }
}