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-limit

v0.0.3

Published

Vue simple array pagination, fully customizable

Downloads

18

Readme

vue-limit

Vue simple array pagination, fully customizable
Live Demo

Install

npm install --save vue-limit

Usage

  import Vue from '../node_modules/vue/dist/vue.js'
  import limit from './index.vue'

  new Vue({
    components: {
      'vue-limit': limit
    },
    data: {
      model: {
        page: 1,
        time: 0,
        rows: 3,
        label: 'Page (${page} / ${pages})',
        firstLabel: 'First',
        previousLabel: 'Previous',
        nextLabel: 'Next',
        lastLabel: 'Last'
      },
      input: [
        'item 1',
        'item 2',
        'item 3',
        'item 4',
        'item 5',
        'item 6',
        'item 7',
        'item 8',
        'item 9',
        'item 10'
      ],
      output: []
    }
  }).$mount('#app')
  <div style="margin:20px">
    <vue-limit v-bind="model" :model="model" :input="input" :output="output" />
  </div>
  <div style="margin:20px">
    <ul>
      <li v-for="out in output">{{out}}</li>
    </ul>
  </div>

Props

  • model
    • type: Object
    • required: true
    • description: Object model
  • id
    • type: String
    • default: page
    • description: variable id inside object
  • rows
    • type: Number
    • default: 10
    • description: max number of elements of input array per page
  • input
    • type: Array
    • default: []
    • description: Input data, component don't touch in this array, read only
  • output
    • type: Array
    • default: []
    • description: You should pass an empty array inside your data scope, this array will be stored result of pagination, observe that in case of objects exact the same object from input will be passed
  • label
    • type: String
    • default: Page (${page} / ${pages})
    • description: String that will be used on select, page and pages are the only available variables
  • time
    • type: Number
    • default: 0
    • description: 0 does nothing, greater than 0 means time in second to go automatically to next page
  • firstLabel
    • type: String
    • default: First
    • description: First button label
  • previousLabel
    • type: String
    • default: Previous
    • description: Previous button label
  • nextLabel
    • type: String
    • default: Next
    • description: Next button label
  • lastLabel
    • type: String
    • default: Last
    • description: Last button label
  • buttonClass
    • type: String, Array, Object
    • default: ''
    • description: CSS class aplied to all the buttons, for example with bootstrap3 use btn btn-default
  • buttonStyle
    • type: String, Array, Object
    • default: ''
    • description: CSS inline style for all buttons
  • selectClass
    • type: String, Array, Object
    • default: ''
    • description: CSS class aplied to select, for example with bootstrap3 use form-control
  • selectStyle
    • type: String, Array, Object
    • default: ''
    • description: CSS inline style to select, for example with bootstrap3 use width:auto;display:inline

Slots

  • slots inside the buttons, for use icons instead of labels:

    • first
    • previous
    • next
    • last
  • slot for substitute the select input, use this slot if you want a simple label or something like input=range

    • select
      • scope
        • id: id passed in the props
        • model: model passed in the props
        • label: current label, the same passed in the props but with variable substitution
        • options: array with {id, label} that generate select

    As you can see you can be use any framework you like with very good results
    And you can be very creative for substitute the select for other thing

Contribute

We need help! Our goals are:

  • Support an easy and quick api interface for array pagination
  • Add tests
  • More usage examples and better home page
  • Add support to most browsers

What is outside of the scope of this project:

  • Use any kind of css framework or any layout decision