Interface PaginatedOption<T, L, K>

interface PaginatedOption<T, L, K> {
    lastKey?: K;
    limit?: LimitFn<"total" | L, T>;
    onDone?: ((totalPage: number, key: undefined | K, data: T[]) => undefined | boolean);
    onNextPage?: ((currentPage: number, key: undefined | K, data: T[]) => unknown);
}

Type Parameters

Properties

lastKey?: K

上一页的 key

limit?: LimitFn<"total" | L, T>

true: 继续下一页;false: 停止获取

onDone?: ((totalPage: number, key: undefined | K, data: T[]) => undefined | boolean)

当结束时触发

Type declaration

    • (totalPage, key, data): undefined | boolean
    • Parameters

      • totalPage: number
      • key: undefined | K
      • data: T[]

      Returns undefined | boolean

      false: 将停止获取下一页

onNextPage?: ((currentPage: number, key: undefined | K, data: T[]) => unknown)

当获取下一页时触发

Type declaration

    • (currentPage, key, data): unknown
    • Parameters

      • currentPage: number
      • key: undefined | K
      • data: T[]

      Returns unknown

      false: 将停止获取下一页