⬅️ Back to Table of Contents
📄 index.ts
📊 Analysis Summary
Metric |
Count |
🔧 Functions |
3 |
📦 Imports |
14 |
📊 Variables & Constants |
1 |
🟢 Vue Composition API |
9 |
📐 Interfaces |
2 |
📑 Type Aliases |
1 |
📚 Table of Contents
🛠️ File Location:
📂 packages/core/useOffsetPagination/index.ts
📦 Imports
Name |
Source |
ComputedRef |
vue |
MaybeRef |
vue |
MaybeRefOrGetter |
vue |
Ref |
vue |
UnwrapNestedRefs |
vue |
noop |
@vueuse/shared |
syncRef |
@vueuse/shared |
computed |
vue |
isReadonly |
vue |
isRef |
vue |
reactive |
vue |
toValue |
vue |
watch |
vue |
useClamp |
../../math/useClamp |
Variables & Constants
Name |
Type |
Kind |
Value |
Exported |
returnValue |
{ currentPage: ComputedRef<number>; currentPageSize: ComputedRef<number>; pageCount: any; isFirstPage: any; isLastPage: any; prev: () => void; next: () => void; } |
const |
`{ |
|
currentPage, |
|
|
|
|
currentPageSize, |
|
|
|
|
pageCount, |
|
|
|
|
isFirstPage, |
|
|
|
|
isLastPage, |
|
|
|
|
prev, |
|
|
|
|
next, |
|
|
|
|
}` |
✗ |
|
|
|
Vue Composition API
Name |
Type |
Reactive Variables |
Composables |
computed |
computed |
none |
none |
computed |
computed |
none |
none |
computed |
computed |
none |
none |
watch |
watch |
none |
none |
reactive |
reactive |
none |
none |
watch |
watch |
none |
none |
reactive |
reactive |
none |
none |
watch |
watch |
none |
none |
reactive |
reactive |
none |
none |
Functions
Code
export function useOffsetPagination(options: Omit<UseOffsetPaginationOptions, 'total'>): UseOffsetPaginationInfinityPageReturn
- Parameters:
options: Omit<UseOffsetPaginationOptions, 'total'>
- Return Type:
UseOffsetPaginationInfinityPageReturn
prev(): void
Code
function prev() {
currentPage.value--
}
next(): void
Code
function next() {
currentPage.value++
}
Interfaces
Interface Code
export interface UseOffsetPaginationOptions {
/**
* Total number of items.
*/
total?: MaybeRefOrGetter<number>
/**
* The number of items to display per page.
* @default 10
*/
pageSize?: MaybeRefOrGetter<number>
/**
* The current page number.
* @default 1
*/
page?: MaybeRef<number>
/**
* Callback when the `page` change.
*/
onPageChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown
/**
* Callback when the `pageSize` change.
*/
onPageSizeChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown
/**
* Callback when the `pageCount` change.
*/
onPageCountChange?: (returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown
}
Properties
Name |
Type |
Optional |
Description |
total |
MaybeRefOrGetter<number> |
✓ |
|
pageSize |
MaybeRefOrGetter<number> |
✓ |
|
page |
MaybeRef<number> |
✓ |
|
onPageChange |
(returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown |
✓ |
|
onPageSizeChange |
(returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown |
✓ |
|
onPageCountChange |
(returnValue: UnwrapNestedRefs<UseOffsetPaginationReturn>) => unknown |
✓ |
|
Interface Code
export interface UseOffsetPaginationReturn {
currentPage: Ref<number>
currentPageSize: Ref<number>
pageCount: ComputedRef<number>
isFirstPage: ComputedRef<boolean>
isLastPage: ComputedRef<boolean>
prev: () => void
next: () => void
}
Properties
Name |
Type |
Optional |
Description |
currentPage |
Ref<number> |
✗ |
|
currentPageSize |
Ref<number> |
✗ |
|
pageCount |
ComputedRef<number> |
✗ |
|
isFirstPage |
ComputedRef<boolean> |
✗ |
|
isLastPage |
ComputedRef<boolean> |
✗ |
|
prev |
() => void |
✗ |
|
next |
() => void |
✗ |
|
Type Aliases
type UseOffsetPaginationInfinityPageReturn = Omit<UseOffsetPaginationReturn, 'isLastPage'>;