Skip to content

Pagination ​

Features:

  • Item links
  • Active item
  • Prev and next button

Usage ​

Set the total items using the total props.

vue
<script setup>
import { Pagination } from 'gurunkit';
</script>

<template>
  <Pagination :total="5" />
</template>

Active ​

Set the active item using the active props.

vue
<script setup>
import { Pagination } from 'gurunkit';
</script>

<template>
  <Pagination :total="5" :active="2" />
</template>

Active V-Model ​

Use v-model:active to bind the active item.

vue
<script setup>
import { Pagination } from 'gurunkit';
import { ref } from 'vue';

const active = ref(1);
</script>

<template>
  <Pagination :total="5" v-model:active="active" />
</template>

Change Event ​

Use the change event to detect when the active page changes.

vue
<script setup>
import { Pagination } from 'gurunkit';
import { ref } from 'vue';

const active = ref(1);
const onChangePage = () => alert('page changed');
</script>

<template>
  <Pagination :total="5" v-model:active="active" @change="onChangePage" />
</template>

API ​

Props ​

NameTypeRequiredDefaultDescription
totalnumber✅0Total items
activenumber❌nullActive item

Events ​

NameTypeDescription
update:activenumberactive prop value is updated
changevoidactive prop value is updated

Model Value ​

NameTypeDescription
activenumberSet active item

Released under the MIT License.