Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/liuhuiashazj/pulltorefresh-vue

pulltorefresh vue版本
https://github.com/liuhuiashazj/pulltorefresh-vue

Last synced: 4 months ago
JSON representation

pulltorefresh vue版本

Awesome Lists containing this project

README

        

# pulltorefresh-vue 版本

> pull to refresh for Vue.js

# screenshot
![screenshot](./source/effect.gif)

# Requirements
- [Vue.js](https://github.com/yyx990803/vue) `^1.0.0`

# Installation

## npm
``` bash
npm install pullToRefresh-vue
```
## parameters
```
down: if open pull down to refresh function
up: if open pull up to loadmore function
addNew: refresh callback, used to refresh or insert data to the lists
addMore: loadmore callback, used to loadmore data to the lists
hasMore: if there has more data, used to show pull up icon or 'nomore' message
```

# Usage
``` html


here is the content of what you want to pull down to refresh or pull up to loadmore

may be some ul list

import PullToRefresh from 'pulltorefresh-vue';
export default {
/* other code */
name: 'pullDemo',
methods: {
addNew() {
return new Promise((resolve, reject) => {
this.getNewData().then(() => {
resolve();
});
});
},
addMore() {
let self = this;
return new Promise((resolve, reject)=> {
this.getMoreData().then(() => {
resolve();
});
});
},
}
/* other code */
}

```