提交
This commit is contained in:
1 parent
d84f4b944c
commit
7c838cfb2d
249 files changed
+50600
-18556
No files matched your search
@@ -1,5 +1,7 @@
|
||||
import { computed, ref, type ComputedRef, type Ref } from 'vue'
|
||||
|
||||
import { DEFAULT_LIST_PAGE_SIZE } from '@/utils/table/tableConfig'
|
||||
|
||||
type Source<T> = Ref<T[]> | ComputedRef<T[]> | (() => T[])
|
||||
|
||||
interface UsePagedTableOptions {
|
||||
@@ -9,7 +11,7 @@ interface UsePagedTableOptions {
|
||||
|
||||
export function usePagedTable<T>(source: Source<T>, options: UsePagedTableOptions = {}) {
|
||||
const currentPage = ref(options.initialPage ?? 1)
|
||||
const pageSize = ref(options.initialPageSize ?? 10)
|
||||
const pageSize = ref(options.initialPageSize ?? DEFAULT_LIST_PAGE_SIZE)
|
||||
|
||||
const sourceRows = computed(() => {
|
||||
if (typeof source === 'function') return source()
|
||||
|
||||
Reference in new issue
Block a user