0.0.9 • Published 2 years ago

sarathe-library v0.0.9

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Vue3 + Pagination

image info

You can use use this pagination with both option and composition api.

Install with yarn

yarn add sarathe-library

Install with npm

npm i sarathe-library

  • Import pagination library and css to your component
<script setup>
import {Pagination} from 'sarathe-library';
import 'sarathe-library/dist/sarathe-lib.css'
</script>
  • Add pagination component to template
 <Pagination :items="myArr" @display="getComputedResult"/>

Pagination component accepts array or array of objects as prop and Pagination component emit and event called display.

Full Example

<template>
  <div>
    <table>
      <tbody>
      <tr v-for="displayArr in displayArray">
        {{displayArr}}
      </tr>
      </tbody>
    </table>
    <Pagination :items="myArr" @display="getComputedResult"/>
  </div>
</template>

<script setup>
import { ref,onMounted } from 'vue'
import {Pagination} from 'sarathe-library';
import 'sarathe-library/dist/sarathe-lib.css'

const myArr = ref([]);

let displayArray = ref([])

function getComputedResult(e) {
  displayArray.value = e
}

onMounted(() => {
  for(let i =1 ; i<= 290; i++){
    myArr.value.push('page- ' + i)
  }
})

</script>

<style scoped>

</style>

Props

PropisRequiredUsagesType
itemsyes:items="your actual array"Array
itemsToDisplayno:items-to-display="10"; defaults to 10Number
pageClassnopage-class="css class"; Pagination css classString
pageStyleno:page-style="yourStyleObject"Object
pageActiveClassnopage-active-class="cssClass"; Currently active page classString
pageActiveStyleno:page-active-style="activePageStyleObject"Object
disableShowingLabelno:disable-showing-label="true"; default to trueBoolean

Event

Event nameisRequiredDescription
displayyesThe display event emits computed array which you can use to display inside your template tag

Credits

  • Siddharth Sarathe

  • Pragati Tanwar

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago