feat(admin): users list page-size options [15,20,50,100] with default 15
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ describe('useAdminUserPages 分页状态', () => {
|
|||||||
const fetch = vi.fn().mockResolvedValue(pageOf(['a', 'b'], 35))
|
const fetch = vi.fn().mockResolvedValue(pageOf(['a', 'b'], 35))
|
||||||
const state = useAdminUserPages(fetch)
|
const state = useAdminUserPages(fetch)
|
||||||
await state.loadPage(2)
|
await state.loadPage(2)
|
||||||
expect(fetch).toHaveBeenCalledWith(2, 20)
|
expect(fetch).toHaveBeenCalledWith(2, 15)
|
||||||
expect(state.page.value).toBe(2)
|
expect(state.page.value).toBe(2)
|
||||||
expect(state.items.value).toHaveLength(2)
|
expect(state.items.value).toHaveLength(2)
|
||||||
expect(state.total.value).toBe(35)
|
expect(state.total.value).toBe(35)
|
||||||
@@ -46,7 +46,7 @@ describe('useAdminUserPages 分页状态', () => {
|
|||||||
state.onSizeChange()
|
state.onSizeChange()
|
||||||
await Promise.resolve()
|
await Promise.resolve()
|
||||||
await Promise.resolve()
|
await Promise.resolve()
|
||||||
expect(fetch).toHaveBeenLastCalledWith(1, 20)
|
expect(fetch).toHaveBeenLastCalledWith(1, 15)
|
||||||
state.replaceItem(0, { id: 'u0', account: 'a2' } as never)
|
state.replaceItem(0, { id: 'u0', account: 'a2' } as never)
|
||||||
expect(state.items.value[0]?.account).toBe('a2')
|
expect(state.items.value[0]?.account).toBe('a2')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export function useAdminUserPages(
|
|||||||
const items = ref<Api.AdminUser.Item[]>([])
|
const items = ref<Api.AdminUser.Item[]>([])
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const pageSize = ref(20)
|
const pageSize = ref(15)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const error = ref<Error | null>(null)
|
const error = ref<Error | null>(null)
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@
|
|||||||
v-model:current-page="page"
|
v-model:current-page="page"
|
||||||
v-model:page-size="pageSize"
|
v-model:page-size="pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page-sizes="[20, 50, 100]"
|
:page-sizes="[15, 20, 50, 100]"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
background
|
background
|
||||||
|
|||||||
Reference in New Issue
Block a user