1.0.0 • Published 1 year ago

vue3-bootstrap-paginate v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Vue3 Bootstrap Paginate

Vue3 Bootstrap Paginate is a paging library for VueJS that uses bootstrap's style.

With Bootstrap 3

With Bootstrap 4,5

ndt-pro - vue3-bootstrap-paginate npm version npm downloads License


:cd: Installation

  • npm: npm i vue3-bootstrap-paginate

Usage

You can import and register the component globally in your main.js, or import and use it in a particular component.

Vue2: To register in your main.js

import Vue from 'vue';
// Import the component
import { Vue3BsPaginate } from 'vue3-bootstrap-paginate';

// Register the component globally
Vue.component('Vue3BsPaginate', Vue3BsPaginate);

Vue3: To register in your main.js

import { createApp } from 'vue';

// Import the component
import { Vue3BsPaginate } from 'vue3-bootstrap-paginate';

const app = createApp({});

// Register the component globally
app.component('Vue3BsPaginate', Vue3BsPaginate);

To register in your component

<script>
	import Vue3BsPaginate from 'vue3-bootstrap-paginate';
	export default {
		components: { Vue3BsPaginate },
	};
</script>

Using in your .vue file

<template>
	<Vue3BsPaginate
		:total="150"
		v-model="currentPage"
		:perPage="10"
		:onChange="onChangePage"
		alignment="center"
	/>
</template>

API

Props

PropTypeDefaultOptionsDescription
totalNumberrequiredTotal number of items that you want to paginate
perPageNumber10Total number of items that you explicitly want to show per one page
pagesShownNumber5Maximum pagination page to be shown
v-modelNumberrequiredCurrent active page
sizeString'md''lg','sm'Size of button according to bootstrap
alignmentString'start''center','end'Align the position of the pagination
prevContentString'‹'Content of previous button
nextContentString'›'Content of next button
firstJumpContentString'«'Content of jump to first button
lastJumpContentString'»'Content of jump to last button
showPrevNextButtonBooleantrueShow previous and next button
showJumpButtonsBooleanfalseShow jump to first and last button
onChangeFunction() => { }A function that runs when the user changes a page by clicking any of the elements of the component (Passing the new active page to the function as a parameter)

Project setup

Install dependencies

  • npm: npm install

Start Dev Server

  • npm: npm run serve

Compiles and minifies for production

  • npm: npm run build