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

flex-pagination

v1.0.1

Published

VueJs powerful but simple pagination component which is fully customizable and easy to use.

Downloads

10

Readme

Flex Pagination

version version version version version version

Vue.js 2.0^ powerful but simple pagination component which is fully customizable and easy to use. Check flex pagination documentation for more examples.

Installation

npm install flex-pagination

Basic example

Flex pagination requires [:pagination=""] property which must be of type object and have 2 child properties. [page] type (int) which is current active page;
[total] type (int) which is total amount of pages;

<flex-pagination :pagination="pagination"></flex-pagination>
pagination: { 
    page: 10, 
    total: 50 
}

Ranges

Optional property [:range=""] is defining how many page are shown around current page which are set to 5 by default.
[before] type (int) number of pages before current;
[after] type (int) number of pages after current;

NOTE: Ranges was pulled out of configuration because of its frequent usage.

<flex-pagination :pagination="pagination" :range="range"></flex-pagination>
range: { 
    before: 3, 
    after: 0 
}

Hide elements

[show] property of the [:config="] object defines which visual elements must be hide or show.
[first], [prev], [next], [last] type (boolean) default True;

<flex-pagination :pagination="pagination" :config="config"></flex-pagination>
config: { 
    show: { 
        first: false, 
        last: false, 
        next: true, 
        prev: false
    }
}

Events

Each time you navigate on pagination an event is emitted. By default event name is 'flexp:page'. You can define a custom event name using config [event] property. [event] type (string) default 'flexp:page';

NOTE: The event handler is receiving selected page number in the first parameter.

<flex-pagination :pagination="pagination" :v-on:my:custom:event="myEventHandler" :config="config">
data: { 
    currentPageContent: '',
    pagination: {
        page: 10,

        // NOTE: total pages will be updated after "request" result. 
        // For demonstration purpose, a random number will be taken in between 40 and 50.
        total: 44 
    },
    config: {
        event: 'my:custom:event'
    },
}
methods: { 
    myEventHandler(pageNumber) {
        let self = this;
        self.makeRequest(pageNumber).then(function(response){
            self.currentPageContent = response.data;
        });
    }
}

Hide elements

Each time you navigate on pagination an event is emitted. By default event name is 'flexp:page'. You can define a custom event name using config [event] property. [event] type (string) default 'flexp:page';

NOTE: The event handler is receiving selected page number in the first parameter.

Customization

Check flex pagination documentation for more examples.