UIDefine.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { UICachePolicy, UILayer } from '../framework/ui/UILayer';
  2. // viewId.StoreView
  3. export const UIViewID = {
  4. LoginView: 'LoginView',
  5. HomeView: 'HomeView',
  6. LoadingView: "LoadingView",
  7. } as const;
  8. export type UIViewID = typeof UIViewID[keyof typeof UIViewID];
  9. export interface UIViewConfig {
  10. id: UIViewID;
  11. prefabPath: string;
  12. layer: UILayer;
  13. bundle?: string;
  14. cache?: UICachePolicy;
  15. mutexGroup?: string;
  16. }
  17. /**
  18. * 项目全部 UIView 的静态配置。
  19. */
  20. export const UIViewConfigs: Record<string, UIViewConfig> = {
  21. [UIViewID.LoginView]: {
  22. id: UIViewID.LoginView,
  23. prefabPath: 'ui/login/LoginView',
  24. layer: UILayer.Page,
  25. },
  26. [UIViewID.HomeView]: {
  27. id: UIViewID.HomeView,
  28. prefabPath: 'ui/home/HomeView',
  29. layer: UILayer.Page,
  30. cache: UICachePolicy.Persist,
  31. },
  32. [UIViewID.LoadingView]: {
  33. id: UIViewID.LoadingView,
  34. prefabPath: 'ui/loading/LoadingView',
  35. layer: UILayer.Loading,
  36. cache: UICachePolicy.Persist,
  37. },
  38. };
  39. export function getUIViewConfig(viewId: UIViewID): UIViewConfig {
  40. return UIViewConfigs[viewId];
  41. }