Commit 3bd5ef45 by zyy Committed by GitHub

fix(@vben/common-ui): pagination current page error (#4893)

1 parent 86e52ce5
...@@ -41,6 +41,7 @@ const emit = defineEmits<{ ...@@ -41,6 +41,7 @@ const emit = defineEmits<{
const refTrigger = useTemplateRef<HTMLElement>('refTrigger'); const refTrigger = useTemplateRef<HTMLElement>('refTrigger');
const currentSelect = ref(''); const currentSelect = ref('');
const currentList = ref(props.icons); const currentList = ref(props.icons);
const currentPage = ref(1);
watch( watch(
() => props.icons, () => props.icons,
...@@ -72,6 +73,7 @@ const handleClick = (icon: string) => { ...@@ -72,6 +73,7 @@ const handleClick = (icon: string) => {
}; };
const handlePageChange = (page: number) => { const handlePageChange = (page: number) => {
currentPage.value = page;
setCurrentPage(page); setCurrentPage(page);
}; };
...@@ -114,7 +116,6 @@ defineExpose({ changeOpenState }); ...@@ -114,7 +116,6 @@ defineExpose({ changeOpenState });
class="flex-center flex justify-end overflow-hidden border-t py-2 pr-3" class="flex-center flex justify-end overflow-hidden border-t py-2 pr-3"
> >
<Pagination <Pagination
v-slot="{ page }"
:items-per-page="36" :items-per-page="36"
:sibling-count="1" :sibling-count="1"
:total="total" :total="total"
...@@ -136,7 +137,7 @@ defineExpose({ changeOpenState }); ...@@ -136,7 +137,7 @@ defineExpose({ changeOpenState });
as-child as-child
> >
<Button <Button
:variant="item.value === page ? 'default' : 'outline'" :variant="item.value === currentPage ? 'default' : 'outline'"
class="size-5 p-0 text-sm" class="size-5 p-0 text-sm"
> >
{{ item.value }} {{ item.value }}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!