npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-bulma-pagination-2

v0.5.9

Published

A bulma enabled vue.js 2 pagination component

Downloads

35

Readme

Vue Pagination 2

Note: This package is for use with Vuejs 2. For version 1 please use v-pagination instead.

Simple, generic and non-intrusive pagination component for Vue.js version 2. Presentation is based on bootstrap.

Dependencies

  • Vue.js (>=2.0.0-rc.1). Required.
  • Bootstrap (CSS). Optional.

Installation

npm install vue-pagination-2

import the script:

import {Pagination, PaginationEvent} from 'vue-pagination-2';

Usage

Register the component globally or locally:

Vue.component('pagination', Pagination);

OR

...
components: {
  Pagination
}
...

HTML:

<pagination for="some-entity" :records="500"></pagination>

props:

  • for string required unique identifier for the component instance.

  • records number required number of records

  • per-page number optional records per page. Default: 25

  • chunk number optional max pages per chunk. Default: 10

  • vuex boolean optional Use vuex to manage state

  • count-text string optional total records text. It can consist of up to 3 parts, divided by |.

    • First part: used when there are multiple pages
    • Second part: used when there is only one page
    • Third part: used when there is only one record.

    Default: Showing {from} to {to} of {count} records|{count} records|One record

Handle page selection

Event bus

When a page is selected an event will be dispatched, using the unique id for the component. Listen to it on your bus and respond accordingly:

  PaginationEvent.$on('vue-pagination::some-entity', function(page) {
      // display the relevant records using the page param
  });

Vuex (>=2.0.0)

The component will register a module on your store using the for prop as the name. The module will have a page property that will contain the current page. vue-devtools will give you a nice overview of the data structure.

If you want to latch on to an existing module on your store, use its name in the for prop and manuaully add the following to you store:

{
  myModule:{
    state:{
    ```
      page: 1
    ```
  },
  mutations: {
       ```
       ['myModule/PAGINATE'](state, page) {
              state.page = page
          }
      ```
    }
  }

Programmatic Manipulation

To programmatically set the page apply a ref identifier to the component and use one of the following methods:

  • setPage(page)
  • next()
  • prev()
  • nextChunk()
  • prevChunk()

All methods return true if the page is legal and was thus set, or false otherwise.

Computed Properties

  • totalPages
  • totalChunks
  • currentChunk