UIDefine.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. MailView: "MailView",
  8. } as const;
  9. export type UIViewID = typeof UIViewID[keyof typeof UIViewID];
  10. export interface UIViewConfig {
  11. id: UIViewID;
  12. prefabPath: string;
  13. layer: UILayer;
  14. bundle?: string;
  15. cache?: UICachePolicy;
  16. mutexGroup?: string;
  17. /** true 时,打开该界面不自动显示 LoadingView,默认 false。 */
  18. ignoreLoading?: boolean;
  19. }
  20. /**
  21. * 项目全部 UIView 的静态配置。
  22. */
  23. export const UIViewConfigs: Record<string, UIViewConfig> = {
  24. [UIViewID.LoginView]: {
  25. id: UIViewID.LoginView,
  26. prefabPath: 'ui/login/LoginView',
  27. layer: UILayer.Page,
  28. },
  29. [UIViewID.HomeView]: {
  30. id: UIViewID.HomeView,
  31. prefabPath: 'ui/home/HomeView',
  32. layer: UILayer.Page,
  33. cache: UICachePolicy.Persist,
  34. },
  35. [UIViewID.LoadingView]: {
  36. id: UIViewID.LoadingView,
  37. prefabPath: 'ui/loading/LoadingView',
  38. layer: UILayer.Loading,
  39. cache: UICachePolicy.Persist,
  40. ignoreLoading: true,
  41. },
  42. [UIViewID.MailView]: {
  43. id: UIViewID.MailView,
  44. prefabPath: 'ui/mail/MailView',
  45. layer: UILayer.Popup
  46. },
  47. };
  48. export function getUIViewConfig(viewId: UIViewID): UIViewConfig {
  49. return UIViewConfigs[viewId];
  50. }