global.d.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. type _Arrayable<T> = T | T[];
  2. declare global {
  3. /**
  4. * z-paging返回数据
  5. *
  6. * @since 2.5.3
  7. */
  8. interface ZPagingReturnData<T> {
  9. /**
  10. * 总列表
  11. */
  12. totalList: T[];
  13. /**
  14. * 是否没有更多数据
  15. */
  16. noMore: boolean;
  17. }
  18. /**
  19. * 嵌套父容器信息 [list组件](https://uniapp.dcloud.net.cn/component/list.html)
  20. *
  21. * @since 2.0.4
  22. */
  23. interface ZPagingSetSpecialEffectsArgs {
  24. /**
  25. * 和list同时滚动的组件id,应为外层的scroller
  26. */
  27. id?: string;
  28. /**
  29. * 要吸顶的header顶部距离scroller顶部的距离
  30. * - Android暂不支持
  31. *
  32. * @default 0
  33. */
  34. headerHeight?: number;
  35. }
  36. /**
  37. * z-paging组件实例
  38. */
  39. interface ZPagingInstance<T = any> {
  40. /**
  41. * 重新加载分页数据,pageNo恢复为默认值,相当于下拉刷新的效果
  42. *
  43. * @param [animate=false] 是否展示下拉刷新动画
  44. */
  45. reload: (animate?: boolean) => Promise<ZPagingReturnData<T>>;
  46. /**
  47. * 刷新列表数据,pageNo和pageSize不会重置,列表数据会重新从服务端获取
  48. *
  49. * @since 2.0.4
  50. */
  51. refresh: () => Promise<ZPagingReturnData<T>>;
  52. /**
  53. * 刷新列表数据至指定页
  54. *
  55. * @since 2.5.9
  56. * @param page 目标页数
  57. */
  58. refreshToPage: (page: number) => Promise<ZPagingReturnData<T>>;
  59. /**
  60. * 请求结束
  61. * - 当通过complete传进去的数组长度小于pageSize时,则判定为没有更多了
  62. *
  63. * @param [data] 请求结果数组
  64. * @param [success=true] 是否请求成功
  65. */
  66. complete: (data?: T[] | false, success?: boolean) => Promise<ZPagingReturnData<T>>;
  67. /**
  68. * 请求结束
  69. * - 通过total判断是否有更多数据
  70. *
  71. * @since 2.0.6
  72. * @param data 请求结果数组
  73. * @param total 列表总长度
  74. * @param [success=true] 是否请求成功
  75. */
  76. completeByTotal: (data: T[], total: number, success?: boolean) => Promise<ZPagingReturnData<T>>;
  77. /**
  78. * 请求结束
  79. * - 自行判断是否有更多数据
  80. *
  81. * @since 1.9.2
  82. * @param data 请求结果数组
  83. * @param noMore 是否没有更多数据
  84. * @param [success=true] 是否请求成功
  85. */
  86. completeByNoMore: (data: T[], noMore: boolean, success?: boolean) => Promise<ZPagingReturnData<T>>;
  87. /**
  88. * 请求失败
  89. * - 通过方法传入请求失败原因,将请求失败原因传递给z-paging展示
  90. *
  91. * @since 2.6.3
  92. * @param cause 请求失败原因
  93. */
  94. completeByError: (cause: string) => Promise<ZPagingReturnData<T>>;
  95. /**
  96. * 请求结束
  97. * - 保证数据一致
  98. *
  99. * @since 1.6.4
  100. * @param data 请求结果数组
  101. * @param key dataKey,需与:data-key绑定的一致
  102. * @param [success=true] 是否请求成功
  103. */
  104. completeByKey: (data: T[], key: string, success?: boolean) => Promise<ZPagingReturnData<T>>;
  105. /**
  106. * 清空分页数据,pageNo恢复为默认值
  107. *
  108. * @since 2.1.0
  109. */
  110. clear: () => void;
  111. /**
  112. * 从顶部添加数据,不会影响分页的pageNo和pageSize
  113. *
  114. * @param data 需要添加的数据,可以是一条数据或一组数据
  115. * @param [scrollToTop=true] 是否滚动到顶部,不填默认为true
  116. * @param [animate=true] 是否使用动画滚动到顶部
  117. */
  118. addDataFromTop: (data: _Arrayable<T>, scrollToTop?: boolean, animate?: boolean) => void;
  119. /**
  120. * 【不推荐】重新设置列表数据,调用此方法不会影响pageNo和pageSize,也不会触发请求
  121. * - 适用场景:当需要删除列表中某一项时,将删除对应项后的数组通过此方法传递给z-paging
  122. *
  123. * @param data 修改后的列表数组
  124. */
  125. resetTotalData: (data: T[]) => void;
  126. /**
  127. * 终止下拉刷新状态
  128. *
  129. * @since 2.1.0
  130. */
  131. endRefresh: () => void;
  132. /**
  133. * 手动更新自定义下拉刷新view高度
  134. * - 常用于某些情况下使用slot="refresher"插入的view高度未能正确计算导致异常时手动更新其高度
  135. *
  136. * @since 2.6.1
  137. */
  138. updateCustomRefresherHeight: () => void;
  139. /**
  140. * 手动关闭二楼
  141. *
  142. * @since 2.7.7
  143. */
  144. closeF2: () => void;
  145. /**
  146. * 手动触发上拉加载更多
  147. * - 非必须,可依据具体需求使用,例如当z-paging未确定高度时,内部的scroll-view会无限增高,此时z-paging无法得知是否滚动到底部,您可以在页面的onReachBottom中手动调用此方法触发上拉加载更多
  148. *
  149. * @param [source] 触发加载更多的来源类型
  150. */
  151. doLoadMore: (source?: "click" | "toBottom") => void;
  152. /**
  153. * 当使用页面滚动并且自定义下拉刷新时,请在页面的onPageScroll中调用此方法,告知z-paging当前的pageScrollTop,否则会导致在任意位置都可以下拉刷新
  154. * - 若引入了mixins,则不需要调用此方法
  155. *
  156. * @param scrollTop 从page的onPageScroll中获取的scrollTop
  157. */
  158. updatePageScrollTop: (scrollTop: number) => void;
  159. /**
  160. * 在使用页面滚动并且设置了slot="top"时,默认初次加载会自动获取其高度,并使内部容器下移,当slot="top"的view高度动态改变时,在其高度需要更新时调用此方法
  161. */
  162. updatePageScrollTopHeight: () => void;
  163. /**
  164. * 在使用页面滚动并且设置了slot="bottom"时,默认初次加载会自动获取其高度,并使内部容器下移,当slot="bottom"的view高度动态改变时,在其高度需要更新时调用此方法
  165. */
  166. updatePageScrollBottomHeight: () => void;
  167. /**
  168. * 更新slot="left"和slot="right"宽度,当slot="left"或slot="right"宽度动态改变后调用
  169. *
  170. * @since 2.3.5
  171. */
  172. updateLeftAndRightWidth: () => void;
  173. /**
  174. * 更新fixed模式下z-paging的布局,在onShow时候调用,以修复在iOS+h5+tabbar+fixed+底部有安全区域的设备中从tabbar页面跳转到无tabbar页面后返回,底部有一段空白区域的问题
  175. *
  176. * @since 2.6.5
  177. */
  178. updateFixedLayout: () => void;
  179. /**
  180. * 在使用动态高度虚拟列表时,若在列表数组中需要插入某个item,需要调用此方法
  181. *
  182. * @since 2.5.9
  183. * @param item 插入的数据项
  184. * @param index 插入的cell位置,若为2,则插入的item在原list的index=1之后,从0开始
  185. */
  186. doInsertVirtualListItem: (item: T, index: number) => void;
  187. /**
  188. * 在使用动态高度虚拟列表时,手动更新指定cell的缓存高度
  189. * - 当cell高度在初始化之后再次改变时调用
  190. *
  191. * @since 2.4.0
  192. * @param index 需要更新的cell在列表中的位置,从0开始
  193. */
  194. didUpdateVirtualListCell: (index: number) => void;
  195. /**
  196. * 在使用动态高度虚拟列表时,若删除了列表数组中的某个item,需要调用此方法以更新高度缓存数组
  197. *
  198. * @since 2.4.0
  199. * @param index 需要更新的cell在列表中的位置,从0开始
  200. */
  201. didDeleteVirtualListCell: (index: number) => void;
  202. /**
  203. * 设置本地分页,请求结束(成功或者失败)调用此方法,将请求的结果传递给z-paging作分页处理
  204. * - 若调用了此方法,则上拉加载更多时内部会自动分页,不会触发@query所绑定的事件
  205. *
  206. * @param data 请求结果数组
  207. * @param [success=true] 是否请求成功
  208. */
  209. setLocalPaging: (data: T[], success?: boolean) => Promise<ZPagingReturnData<T>>;
  210. /**
  211. * 手动触发滚动到顶部加载更多,聊天记录模式时有效
  212. */
  213. doChatRecordLoadMore: () => void;
  214. /**
  215. * 添加聊天记录,use-chat-record-mode为true时有效
  216. *
  217. * @param data 需要添加的聊天数据,可以是一条数据或一组数据
  218. * @param [scrollToBottom=true] 是否滚动到底部
  219. * @param [animate=true] 是否使用动画滚动到底部
  220. */
  221. addChatRecordData: (data: _Arrayable<T>, scrollToBottom?: boolean, animate?: boolean) => void;
  222. /**
  223. * 滚动到顶部
  224. *
  225. * @param [animate=true] 是否有动画效果
  226. */
  227. scrollToTop: (animate?: boolean) => void;
  228. /**
  229. * 滚动到底部
  230. *
  231. * @param [animate=true] 是否有动画效果
  232. */
  233. scrollToBottom: (animate?: boolean) => void;
  234. /**
  235. * 滚动到指定view
  236. * - vue中有效,若此方法无效,请使用scrollIntoViewByNodeTop
  237. *
  238. * @param id 需要滚动到的view的id值,不包含"#"
  239. * @param [offset=0] 偏移量,单位为px
  240. * @param [animate=false] 是否有动画效果
  241. */
  242. scrollIntoViewById: (id: string, offset?: number, animate?: boolean) => void;
  243. /**
  244. * 滚动到指定view
  245. * - vue中有效
  246. *
  247. * @since 1.7.4
  248. * @param top 需要滚动的view的top值(通过uni.createSelectorQuery()获取)
  249. * @param [offset=0] 偏移量,单位为px
  250. * @param [animate=false] 是否有动画效果
  251. */
  252. scrollIntoViewByNodeTop: (top: number, offset?: number, animate?: boolean) => void;
  253. /**
  254. * 滚动到指定view
  255. * - vue中有效
  256. * - 与scrollIntoViewByNodeTop的不同之处在于,scrollToY传入的是view相对于屏幕的top值,而scrollIntoViewByNodeTop传入的top值并非是固定的,通过uni.createSelectorQuery()获取到的top会因列表滚动而改变
  257. *
  258. * @param top 需要滚动到的view的top值,单位为px
  259. * @param [offset=0] 偏移量,单位为px
  260. * @param [animate=false] 是否有动画效果
  261. */
  262. scrollToY: (top: number, offset?: number, animate?: boolean) => void;
  263. /**
  264. * 滚动到指定view
  265. * - nvue或虚拟列表中有效
  266. * - 在nvue中的cell必须设置 :ref="`z-paging-${index}`"
  267. *
  268. * @param index 需要滚动到的view的index(第几个)
  269. * @param [offset=0] 偏移量,单位为px
  270. * @param [animate=false] 是否有动画效果
  271. */
  272. scrollIntoViewByIndex: (index: number, offset?: number, animate?: boolean) => void;
  273. /**
  274. * 滚动到指定view
  275. * - nvue中有效
  276. *
  277. * @param view 需要滚动到的view(通过this.$refs.xxx获取)
  278. * @param [offset=0] 偏移量,单位为px
  279. * @param [animate=false] 是否有动画效果
  280. */
  281. scrollIntoViewByView: (view: any, offset?: number, animate?: boolean) => void;
  282. /**
  283. * 设置nvue List的specialEffects
  284. *
  285. * @since 2.0.4
  286. * @param args 参见https://uniapp.dcloud.io/component/list?id=listsetspecialeffects
  287. */
  288. setSpecialEffects: (args: ZPagingSetSpecialEffectsArgs) => void;
  289. /**
  290. * 与{@link setSpecialEffects}相同
  291. *
  292. * @since 2.0.4
  293. */
  294. setListSpecialEffects: (args: ZPagingSetSpecialEffectsArgs) => void;
  295. /**
  296. * 手动更新列表缓存数据,将自动截取v-model绑定的list中的前pageSize条覆盖缓存,请确保在list数据更新到预期结果后再调用此方法
  297. *
  298. * @since 2.3.9
  299. */
  300. updateCache: () => void;
  301. /**
  302. * 获取当前版本号
  303. */
  304. getVersion: () => string;
  305. }
  306. /**
  307. * z-paging全局数据
  308. * - uni.$zp
  309. *
  310. * @since 2.6.5
  311. */
  312. interface ZPagingGlobal {
  313. /**
  314. * 配置
  315. */
  316. config: Record<string, any>;
  317. }
  318. /**
  319. * 虚拟列表数据项
  320. *
  321. * @since 2.7.7
  322. */
  323. type ZPagingVirtualItem<T> = T & {
  324. /**
  325. * 元素真实索引
  326. */
  327. zp_index: number;
  328. };
  329. namespace ZPagingEvent {
  330. /**
  331. * query的触发来源:0.用户主动下拉刷新 1.通过reload触发 2.通过refresh触发 3.通过滚动到底部加载更多或点击底部加载更多触发
  332. */
  333. type _QueryFrom = 0 | 1 | 2 | 3;
  334. /**
  335. * 下拉刷新或滚动到底部时会自动触发此方法
  336. *
  337. * @param pageNo 当前第几页
  338. * @param pageSize 每页多少条
  339. * @param from query的触发来源:0.用户主动下拉刷新 1.通过reload触发 2.通过refresh触发 3.通过滚动到底部加载更多或点击底部加载更多触发
  340. */
  341. interface Query {
  342. (pageNo: number, pageSize: number, from: _QueryFrom): void;
  343. }
  344. /**
  345. * 分页渲染的数组改变时触发
  346. *
  347. * @param list 最终的分页数据数组
  348. */
  349. interface ListChange {
  350. (list: []): void;
  351. }
  352. /**
  353. * 下拉刷新状态:0-默认状态 1.松手立即刷新 2.刷新中 3.刷新成功(默认情况下看不到此状态,如果需要展示刷新成功状态,请设置刷新结束以后延时收回的时间,如:refresher-complete-delay="200")
  354. */
  355. type _RefresherStatus = 0 | 1 | 2 | 3;
  356. /**
  357. * 自定义下拉刷新状态改变
  358. * - use-custom-refresher为false时无效
  359. *
  360. * @param status 下拉刷新状态:0-默认状态 1.松手立即刷新 2.刷新中 3.刷新成功(默认情况下看不到此状态,如果需要展示刷新成功状态,请设置刷新结束以后延时收回的时间,如:refresher-complete-delay="200")
  361. */
  362. interface RefresherStatusChange {
  363. (status: _RefresherStatus): void;
  364. }
  365. /**
  366. * 自定义下拉刷新下拉开始
  367. * - use-custom-refresher为false时无效,nvue无效
  368. *
  369. * @param y 当前触摸开始的屏幕点的y值(单位px)
  370. */
  371. interface RefresherTouchstart {
  372. (y: number): void;
  373. }
  374. /**
  375. * touchmove信息
  376. */
  377. interface _RefresherTouchmoveInfo {
  378. /** 下拉的距离 */
  379. pullingDistance: number;
  380. /** 前后两次回调滑动距离的差值 */
  381. dy: number;
  382. /** refresh组件高度 */
  383. viewHeight: number;
  384. /** pullingDistance/viewHeight的比值 */
  385. rate: number;
  386. }
  387. /**
  388. * 自定义下拉刷新下拉拖动中
  389. * - use-custom-refresher为false时无效
  390. * - 在使用wxs的平台上,为减少wxs与js通信折损,只有在z-paging添加@refresherTouchmove时,wxs才会实时将下拉拖动事件传给js,在微信小程序和QQ小程序中,因$listeners无效,所以必须设置:watch-refresher-touchmove="true"方可使此事件被触发
  391. *
  392. * @param info touchmove信息
  393. */
  394. interface RefresherTouchmove {
  395. (info: _RefresherTouchmoveInfo): void;
  396. }
  397. /**
  398. * 自定义下拉刷新下拉结束
  399. * - use-custom-refresher为false时无效,nvue无效
  400. *
  401. * @param y 当前触摸开始的屏幕点的y值(单位px)
  402. */
  403. interface RefresherTouchend {
  404. (y: number): void;
  405. }
  406. /**
  407. * 下拉进入二楼状态:go-二楼开启 close-二楼关闭
  408. */
  409. type _RefresherF2ChangeStatus = 'go' | 'close';
  410. /**
  411. * 下拉进入二楼状态改变
  412. *
  413. * @since 2.7.7
  414. * @param status 下拉进入二楼状态:go-二楼开启 close-二楼关闭
  415. */
  416. interface RefresherF2Change {
  417. (status: _RefresherF2ChangeStatus): void;
  418. }
  419. /**
  420. * 自定义下拉刷新被触发
  421. */
  422. interface OnRefresh {
  423. (): void;
  424. }
  425. /**
  426. * 自定义下拉刷新被复位
  427. */
  428. interface OnRestore {
  429. (): void;
  430. }
  431. /**
  432. * 底部加载更多状态:0-默认状态 1.加载中 2.没有更多数据 3.加载失败
  433. */
  434. type _LoadingStatus = 0 | 1 | 2 | 3;
  435. /**
  436. * 下拉进入二楼状态改变
  437. *
  438. * @param status 底部加载更多状态:0-默认状态 1.加载中 2.没有更多数据 3.加载失败
  439. */
  440. interface LoadingStatusChange {
  441. (status: _LoadingStatus): void;
  442. }
  443. /**
  444. * 点击空数据图中重新加载后是否进行reload操作,默认为是。如果需要禁止reload事件,则调用handler(false)
  445. */
  446. type _EmptyViewReloadHandler = (value: boolean) => void;
  447. /**
  448. * 点击了空数据图中的重新加载按钮
  449. *
  450. * @since 1.8.0
  451. * @param handler 点击空数据图中重新加载后是否进行reload操作,默认为是。如果需要禁止reload事件,则调用handler(false)
  452. */
  453. interface EmptyViewReload {
  454. (handler: _EmptyViewReloadHandler): void;
  455. }
  456. /**
  457. * 点击了空数据图view
  458. *
  459. * @since 2.3.3
  460. */
  461. interface EmptyViewClick {
  462. (): void;
  463. }
  464. /**
  465. * 请求失败状态改变
  466. *
  467. * @since 2.5.0
  468. * @param isLoadFailed 当前是否是请求失败状态,为true代表是,反之为否;默认状态为否
  469. */
  470. interface IsLoadFailedChange {
  471. (isLoadFailed: boolean): void;
  472. }
  473. /**
  474. * 点击返回顶部按钮后是否滚动到顶部,默认为是。如果需要禁止滚动到顶部事件,则调用handler(false)
  475. */
  476. type _BackToTopClickHandler = (value: boolean) => void;
  477. /**
  478. * 点击了返回顶部按钮
  479. *
  480. * @since 2.6.1
  481. * @param handler 点击返回顶部按钮后是否滚动到顶部,默认为是。如果需要禁止滚动到顶部事件,则调用handler(false)
  482. */
  483. interface BackToTopClick {
  484. (handler: _BackToTopClickHandler): void;
  485. }
  486. /**
  487. * 虚拟列表当前渲染的数组改变时触发,在虚拟列表中只会渲染可见区域内+预加载页面的数据
  488. * -nvue无效
  489. *
  490. * @since 2.2.7
  491. * @param list 虚拟列表当前渲染的数组
  492. */
  493. interface VirtualListChange {
  494. (list: []): void;
  495. }
  496. /**
  497. * 使用虚拟列表或内置列表时点击了cell的信息
  498. */
  499. interface _InnerCellClickInfo<T> {
  500. /** 当前点击的item */
  501. item: T;
  502. /** 当前点击的index */
  503. index: number;
  504. }
  505. /**
  506. * 使用虚拟列表或内置列表时点击了cell
  507. * -nvue无效
  508. *
  509. * @since 2.4.0
  510. * @param info 点击cell的信息
  511. */
  512. interface InnerCellClick {
  513. (info: _InnerCellClickInfo<any>): void;
  514. }
  515. /**
  516. * 在聊天记录模式下,触摸列表隐藏了键盘
  517. *
  518. * @since 2.3.6
  519. */
  520. interface HidedKeyboard {
  521. (): void;
  522. }
  523. /**
  524. * 键盘的高度信息
  525. */
  526. interface _KeyboardHeightInfo {
  527. /** 键盘的高度 */
  528. height: number;
  529. }
  530. /**
  531. * 键盘高度改变
  532. * -聊天记录模式启用时才有效,如果在聊天记录模式页面需要监听键盘高度改变,请不要直接通过uni.onKeyboardHeightChange监听,否则可能导致z-paging内置的键盘高度改变监听失效。ps:H5、百度小程序、抖音小程序、飞书小程序不支持
  533. *
  534. * @since 2.7.1
  535. * @param info 键盘高度信息
  536. */
  537. interface KeyboardHeightChange {
  538. (info: _KeyboardHeightInfo): void;
  539. }
  540. /**
  541. * 列表滚动信息(vue)
  542. */
  543. interface _ScrollInfo {
  544. detail: {
  545. scrollLeft: number;
  546. scrollTop: number;
  547. scrollHeight: number;
  548. scrollWidth: number;
  549. deltaX: number;
  550. deltaY: number;
  551. }
  552. }
  553. /**
  554. * 列表滚动信息(nvue)
  555. */
  556. interface _ScrollInfoN {
  557. contentSize: {
  558. width: number;
  559. height: number;
  560. };
  561. contentOffset: {
  562. x: number;
  563. y: number;
  564. };
  565. isDragging: boolean;
  566. }
  567. /**
  568. * 列表滚动时触发
  569. *
  570. * @param event 滚动事件信息,vue使用_ScrollInfo,nvue使用_ScrollInfoN
  571. */
  572. interface Scroll {
  573. (event: _ScrollInfo | _ScrollInfoN): void;
  574. }
  575. /**
  576. * scrollTop改变时触发,使用点击返回顶部时需要获取scrollTop时可使用此事件
  577. *
  578. * @param scrollTop
  579. */
  580. interface ScrollTopChange {
  581. (scrollTop: number): void;
  582. }
  583. /**
  584. * 内置的scroll-view滚动底部时的来源(toBottom滚动到底部;click点击了加载更多view)
  585. */
  586. type _ScrolltolowerFrom = 'toBottom' | 'click';
  587. /**
  588. * 内置的scroll-view滚动底部时触发
  589. *
  590. * @param from 来源(toBottom滚动到底部;click点击了加载更多view)
  591. */
  592. interface Scrolltolower {
  593. (from: _ScrolltolowerFrom): void;
  594. }
  595. /**
  596. * 内置的scroll-view滚动顶部时触发
  597. */
  598. interface Scrolltoupper {
  599. (): void;
  600. }
  601. /**
  602. * 滚动结束时触发事件信息
  603. */
  604. interface _ScrollendEvent {
  605. contentSize: {
  606. width: number;
  607. height: number;
  608. };
  609. contentOffset: {
  610. x: number;
  611. y: number;
  612. };
  613. isDragging: boolean;
  614. }
  615. /**
  616. * 内置的list滚动结束时触发
  617. * -仅nvue有效
  618. *
  619. * @since 2.7.3
  620. * @param event 滚动结束时触发事件信息
  621. */
  622. interface Scrollend {
  623. (event: _ScrollendEvent): void;
  624. }
  625. /**
  626. * z-paging中内容高度改变时触发
  627. *
  628. * @since 2.1.3
  629. * @param height 改变后的高度
  630. */
  631. interface ContentHeightChanged {
  632. (height: number): void;
  633. }
  634. /**
  635. * 列表触摸的方向,top代表用户将列表向上移动(scrollTop不断减小),bottom代表用户将列表向下移动(scrollTop不断增大)
  636. */
  637. type _TouchDirection = 'top' | 'bottom';
  638. /**
  639. * 监听列表触摸方向改变
  640. *
  641. * @since 2.3.0
  642. * @param direction 列表触摸的方向,top代表用户将列表向上移动(scrollTop不断减小),bottom代表用户将列表向下移动(scrollTop不断增大)
  643. */
  644. interface TouchDirectionChange {
  645. (direction: _TouchDirection): void;
  646. }
  647. }
  648. }
  649. export {};