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

infinite-loading

v0.2.8

Published

vue-infinite-loading based on bedlate's vue-data-loading

Downloads

225

Readme

vue-data-loading

中文文档

Another component for infinite scroll and pull down/up to load data.

Here is a demo: HackNews

vue-data-loading

Install

npm install vue-data-loading --save

Usage

Import first:

import VueDataLoading from 'vue-data-loading'

Register as a component:

components: {
    VueDataLoading
},

The only you need to do is wrapping your data with vue-data-loading tag.

<vue-data-loading>
    <ul>
        <li v-for="(item, index) in list" :key="index">Item: {{item}}</li>
    </ul>
</vue-data-loading>

However, you can pass some props or events to the component.

<vue-data-loading :loading="loading" :listens="['pull-down', 'infinite-scroll']" @infinite-scroll="infiniteScroll" @pull-down="pullDown">
    <!--your data here-->
</vue-data-loading>

Sometimes, you may want to change the default style or text(html), that is easy, just edit the slot:

Here is a example for infinite-scroll-loading slot:

default:

<slot :name="infinite-scroll-loading">加载中...</slot>

edit:

<div slot="infinite-scroll-loading" class="some-style-you-like">
    <img src="/path/to/your-icon.png">
    <span>loading...</span>
</div>

Here is a full example

API

Props

loading

Type: boolean

Default: false

The component will not trigger any events while loading is true.

It should be true when data are downloading, and false when finished.

completed

Type: boolean

Default: false

The component will not trigger infinite-scroll if true.

It should be true when all data have be loaded.

init-scroll

Type: boolean

Default: false

The component will trigger infinite-scroll once if true when it has be mounted.

It uses to bootstrap when page first-time loads.

distance

Type: number

Default: 60

Unit: px

Only available for touch* event, when pull distance is not less than it, pull-down or pull-up will be triggered.

offset

Type: number

Default: 0

Unit: px

Sometimes you want to change bottom offset to trigger infinite-scroll in advance.

listens

Type: array

Default: ['infinite-scroll', 'pull-down', 'pull-up']

The component will not trigger the event if it not in the list.

container

Type: string

Required: false

All events bind on window if it is not set, or you need to specify a container ref to it.

Events

infinite-scroll

Emit when container has already scrolled to bottom of window

pull-down

Emit when container has already pulled down

pull-up

Emit when container has already pulled up

Slots

infinite-scroll-loading

Display when container has already scrolled to bottom of window and data is loading

pull-down-before

Display when distance of pull-down is less then distance prop

pull-down-ready

Display when distance of pull-down is not less then distance prop

pull-down-loading

Display when container has already pull-down and data is loading

pull-up-before

Display when distance of pull-up is less then distance prop

pull-up-ready

Display when distance of pull-up is not less then distance prop

pull-up-loading

Display when container has already pull-up and data is loading

Develop

# install dependencies
npm install

# serve example with hot reload at localhost:8080
npm run dev

# build vue-data-loading component
npm run dist