0.2.9 • Published 1 year ago

vue-down-refresh v0.2.9

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

vue-down-refresh

Vuejs 2.0 for mobile implements vue down refresh.

Usage

Install

npm install vue-down-refresh --save

CommonJS

var VueDownRefresh = require('vue-down-refresh');

new Vue({
    components: {
        'vue-down-refresh': VueDownRefresh
    },
    data: function () {
        return {};
    },
    methods: {
        onRefresh: function() {
            return new Promise(function (resolve, reject) {
                setTimeout(function () {
                    resolve();
                }, 1000);
            });
        }
    },
    template: '<vue-down-refresh :on-refresh="onRefresh"></vue-down-refresh>'
});

ES6

import VueDownRefresh from 'vue-down-refresh';

new Vue({
    components: {
        'vue-down-refresh': VueDownRefresh
    },
    data: function () {
        return {};
    },
    methods: {
        onRefresh: function() {
            return new Promise(function (resolve, reject) {
                setTimeout(function () {
                    resolve();
                }, 1000);
            });
        }
    },
    template: '<vue-down-refresh :on-refresh="onRefresh"></vue-down-refresh>'
});

Props

PropertyDescription
onRefreshrefresh event;Should return a promise.
config{errorLabel: label shows when errorstartLabel: label shows when pull down startreadyLabel: label shows when ready to refreshloadingLabel: label shows when loadingpullDownHeight: the height toggle pull down refresh action}

Contribution

First, install dependencies

npm install

Second, setup development environment

npm run dev

License

MIT