components.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. interface AyPageInfo {
  2. /**
  3. * 页码
  4. */
  5. page?: number
  6. /**
  7. * 每页数据量
  8. */
  9. size?: number
  10. /**
  11. * 总页数
  12. */
  13. pages?: number
  14. }
  15. /**
  16. * 通知当前数据加载完毕方法参数
  17. */
  18. interface AyContainerMethodsLoadedArgs {
  19. /**
  20. * 加载完成后的提示文案 默认 '没有更多了'
  21. */
  22. finishedText?: string
  23. /**
  24. * 加载过程中的提示文案 默认 '加载中...'
  25. */
  26. loadingText?: string
  27. /**
  28. * 加载失败后的提示文案 默认 '加载失败'
  29. */
  30. errorText?: string
  31. /**
  32. * 请求状态
  33. */
  34. reqState: enums.ReqState
  35. /**
  36. * 总页数
  37. */
  38. pages?: number
  39. }
  40. /**
  41. * 分页组件加载数据事件参数
  42. */
  43. interface AyContainerRefreshArgs extends AyPageInfo {
  44. /**
  45. * true:上拉加载,false:下拉更新
  46. */
  47. isAdd?: boolean
  48. }
  49. interface AyContainerEntryArgs {
  50. /**
  51. * 生命周期类型
  52. */
  53. loadType?: enums.LoadType
  54. /**
  55. * 页面参数
  56. */
  57. query?: AnyObject
  58. // options?: Parameters<Parameters<typeof onShow>[0]>[0]
  59. /**
  60. * 分页组件加载数据事件参数
  61. */
  62. cras?: AyContainerRefreshArgs
  63. /** 扩展参数 */
  64. exts?
  65. }
  66. /**
  67. * 分页组件方法
  68. */
  69. interface AyContainerPullMethods {
  70. onLoad?(): void
  71. /**
  72. * 通知分页组件当前数据加载完毕
  73. */
  74. loaded?(args: AyContainerMethodsLoadedArgs): void
  75. /**
  76. * 分页组件加载数据-内部方法
  77. */
  78. refresh?(args: AyContainerRefreshArgs): void
  79. /** 容器通知页面加载数据 */
  80. containerRefresh?(args: AyContainerRefreshArgs): void
  81. }
  82. /**
  83. 页面生命周期入口的回调函数
  84. */
  85. type AyEntranceCallBack = (args?: AyContainerEntryArgs) => void
  86. interface AyEntranceExt {
  87. /**
  88. * 追加拦截的生命周期函数
  89. */
  90. addLoadTypes?: Array<enums.LoadType>
  91. /** 分页组件加载数据事件参数默认值 */
  92. defAyContainerRefreshArgs?: AyContainerRefreshArgs
  93. }
  94. /**
  95. 页面生命周期入口,默认拦截enums.LoadType.onLoad、enums.LoadType.refresh, 可配置enums.LoadType 枚举
  96. */
  97. type AyEntrance = (callback?: AyEntranceCallBack, ext?: AyEntranceExt) => void
  98. /**
  99. 通知当前数据加载完毕方法参数
  100. */
  101. type AyContainerLoaded = (args: AyContainerMethodsLoadedArgs) => void