feat: migrate Pagination Header and InputOTP with field and event regressions
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Pagination,
|
||||
PaginationContent,
|
||||
PaginationItem,
|
||||
PaginationLink,
|
||||
PaginationNext,
|
||||
PaginationNextIcon,
|
||||
PaginationPrevious,
|
||||
PaginationPreviousIcon,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const totalPages = 3;
|
||||
const smPage = ref(1);
|
||||
const mdPage = ref(1);
|
||||
const lgPage = ref(1);
|
||||
|
||||
const groups = [
|
||||
{ key: "sm", label: "小", page: smPage },
|
||||
{ key: "md", label: "中", page: mdPage },
|
||||
{ key: "lg", label: "大", page: lgPage },
|
||||
] as const;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col gap-6">
|
||||
<div v-for="group in groups" :key="group.key" class="flex flex-col gap-2">
|
||||
<span class="text-xs font-medium text-muted">{{ group.label }}</span>
|
||||
<Pagination class="justify-center" :size="group.key">
|
||||
<PaginationContent>
|
||||
<PaginationItem>
|
||||
<PaginationPrevious
|
||||
:is-disabled="group.page.value === 1"
|
||||
@click="group.page.value = group.page.value - 1"
|
||||
>
|
||||
<PaginationPreviousIcon />
|
||||
<span>上一页</span>
|
||||
</PaginationPrevious>
|
||||
</PaginationItem>
|
||||
<PaginationItem v-for="p in totalPages" :key="p">
|
||||
<PaginationLink
|
||||
:is-active="p === group.page.value"
|
||||
@click="group.page.value = p"
|
||||
>
|
||||
{{ p }}
|
||||
</PaginationLink>
|
||||
</PaginationItem>
|
||||
<PaginationItem>
|
||||
<PaginationNext
|
||||
:is-disabled="group.page.value === totalPages"
|
||||
@click="group.page.value = group.page.value + 1"
|
||||
>
|
||||
<span>下一页</span>
|
||||
<PaginationNextIcon />
|
||||
</PaginationNext>
|
||||
</PaginationItem>
|
||||
</PaginationContent>
|
||||
</Pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user