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

vant-autoload

v1.1.0

Published

general autoload biz components based on vant

Downloads

6

Readme

vant-autoload

中文

general autoload biz components based on @youzan/vant

Update

1.1.0
  1. add content slot as main view
  2. use vueg as skeleton render when loading
1.0.0
  1. vant-autoload release

Install

import Autoload from 'vant-autoload';

Vue.component(Autoload.name, Autoload);

Usage

Basic Usage

<autoload 
    :to="true"
    :clickable="true"
    :view="objView"
    :finished="finished"
    :loading="loading"
    :limit="10"
    :value="value"
    :canSwipe="true"
    :swipeRightView="swipeRightView"
    v-on:load="load"
    v-on:swipe-click="load" />
class ViewModel {
    constructor(obj) {
        this.to = ''; // generate where you want jump
    }
}
const objView = {
    props: {
      value: ViewModel
    },
    render: h => h('span', 'Single Card Content' + this.value)
};
const swipeRightView = {
    props: {
      value: ViewModel,
      index: {
        type: Number
      }
    },
    render: h => h('span', 'Delete' + this.value)
};
export default {
  data() {
    return {
      value: [],
      objView: objView,
      swipeRightView: swipeRightView,
      loading: false,
      finished: false
    };
  },
  methods: {
    load() {
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.value.push(new ViewModel(this.value.length + 1));
        }
        this.loading = false;

        if (this.value.length >= 40) {
          this.finished = true;
        }
      }, 500);
    }
  }
};

Further Usage

<autoload 
    :to="true"
    :clickable="true"
    :view="objView"
    :finished="finished"
    :loading="loading"
    :limit="10"
    :value="value"
    :canSwipe="true"
    v-on:load="load">
    <right-view 
        slot="right" 
        slot-scope="content" 
        v-bind="content" v-on:swipe-click="load">
</autoload>
const objView = {
    props: {
      value: Object
    },
    render: h => h('span', 'Single Card Content' + this.value)
};
const rightView = {
    props: {
      value: Object,
      index: {
        type: Number
      }
    },
    render: h => h('button', {
        on: {
            click() {
                this.$emit('swipe-click');
            }
        }
    }, 'Delete' + this.value)
};
export default {
  components: {
    rightView: rightView,
  },
  data() {
    return {
      value: [],
      objView: objView,
      loading: false,
      finished: false
    };
  },
  methods: {
    load() {
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.value.push(new ViewModel(this.value.length + 1));
        }
        this.loading = false;

        if (this.value.length >= 40) {
          this.finished = true;
        }
      }, 500);
    }
  }
};

API

| Attribute | Description | Type | Default | Required | |-----------|-----------|-----------|-------------|------| | to | Whether the van-cell $router.push() when clicking | Boolean | false | true | | clickable | Whether the van-cell reacts when clicking | Boolean | false | false | | view | The main cell view, will be wrapped by van-cell | VueComponent | | true | | canSwipe | Whether support swipe right view | Boolean | false | false | | value | The objects to be rendered | Array | [] | true | | swipeRightView | If canSwipe, will render the swipe right view base on van-cell-swipe | VueComponent | | true | | finished | Whether avoid emit loadEvent | Boolean | true | false | | loading | Current loading state, if true, show loading components | Boolean | false | false | | limit | Reserved attr | Number | 5 | false |

slot

| Attribute | Description | Type | Default | Required | |-----------|-----------|-----------|-------------|------| | content[Experimental] | * now you can use content slot as view more like vue style, rather than react style * | VueComponent | | false | | right | When swiping, the swiped item and index will be as the prop pass to the components | VueComponent | | false |

Origin Event

| Event | Description | Arguments | |-----------|-----------|-----------| | load | Triggered when the distance between the scrollbar and the bottom is less than offset | - |

Transmit RightView Event

| Event | Description | Arguments | |-----------|-----------|-----------| | any | The event $emit by rightView will also export on this components, so just use v-on you can get the rightView events. For simplely, the listeners is not filtered currently | - |