An open API service indexing awesome lists of open source software.

https://github.com/lakb248/vue-pull-refresh

A pull down refresh component implement by vuejs
https://github.com/lakb248/vue-pull-refresh

Last synced: 4 months ago
JSON representation

A pull down refresh component implement by vuejs

Awesome Lists containing this project

README

          

# vue-pull-refresh
[![Build Status](https://travis-ci.org/lakb248/vue-pull-refresh.svg?branch=master)](https://travis-ci.org/lakb248/vue-pull-refresh)

> A pull down refresh component implements by vuejs 2.0 for mobile.

## Demo

[Demo](https://lakb248.github.io/vue-pull-refresh)

PS: Please use browsers that support Promise

## Usage

### Install

```bash
npm install vue-pull-refresh --save
```

### CommonJS

```javascript
var VuePullRefresh = require('vue-pull-refresh');

new Vue({
components: {
'vue-pull-refresh': VuePullRefresh
},
data: function () {
return {};
},
methods: {
onRefresh: function() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve();
}, 1000);
});
}
},
template: ''
});
```

### ES6
```javascript
import VuePullRefresh from 'vue-pull-refresh';

new Vue({
components: {
'vue-pull-refresh': VuePullRefresh
},
data: function () {
return {};
},
methods: {
onRefresh: function() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve();
}, 1000);
});
}
},
template: ''
});
```

### Props
| Property | Description |
|:--|:--|
| onRefresh | refresh event;Should return a promise. |
| config | {
errorLabel: label shows when error
startLabel: label shows when pull down start
readyLabel: label shows when ready to refresh
loadingLabel: label shows when loading
pullDownHeight: the height toggle pull down refresh action
} |

## Contribution
First, install dependencies
```
npm install
```
Second, setup development environment
```
npm run dev
```

## License

[MIT](http://opensource.org/licenses/MIT)