1.1.1 • Published 3 years ago

@2alheure/vue-pagination v1.1.1

Weekly downloads
-
License
WTFPL
Repository
github
Last release
3 years ago

Vue.js Pagination

A simple Vue.js component that helps to print and handle a pagination.
This component is compatible with Vue 3.

Installation

First, you must run npm install @2alheure/vue-pagination.
Then, you can import it with import Pagination from "@2alheure/vue-pagination";.

Usage

Call the component with two things:

  • a v-model directive, using a variable representing the active page (integer)
  • a maxPage prop (integer) representing the max page number

Example

<Pagination v-model="page" :maxPage="10" />

<script>
  import Pagination from "@2alheure/vue-pagination";
  
  export default {
    components: {
      Pagination
    },
    data() {
      return {
        page: 3
      }
    }
  };
</script>

Props

NameTypeDefault valueDescription
modelValueNumbernoneThe prop linked to the v-model directive (mandatory).
maxPageNumbernoneThe maximum number of pages (mandatory).
textColorString#4a5568The color of the buttons' text.
backgroundColorString#fffThe color of the buttons' background.
borderColorString#e2e8f0The color of the buttons' borders.
selectedTextColorString#f7fafcThe color of the text for the selected button.
selectedBackgroundColorString#4a5568The color of the background for the selected button.
selectedBorderColorString#e2e8f0The color of the borders for the selected button.
hoverTextColorString#f7fafcThe color of the text for the hovered button.
hoverBackgroundColorString#a0aec0The color of the background for the hovered button.
hoverBorderColorString#e2e8f0The color of the borders for the hovered button.
controlsHoverBorderColorString#cbd5e0The color of the borders for the hovered "Previous" or "Next" buttons.

Events

NameValue typeValueDescription
update:modelValueNumberThe page clickedEmitted each time the page changes
prevNumberThe previous page numberEmitted when the "Previous" button is clicked
nextNumberThe next page numberEmitted when the "Next" button is clicked