Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdahoo committed Apr 22, 2017
1 parent 5529a32 commit 66588b3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 37 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# Vue Scroller ![version](https://img.shields.io/badge/version-%20v2.1.2%20-green.svg) ![vue](https://img.shields.io/badge/vue-%20v2.1%20-green.svg)
# Vue Scroller ![version](https://img.shields.io/badge/version-%20v2.2.0%20-green.svg) ![vue](https://img.shields.io/badge/vue-%20v2.1%20-green.svg)

[Vue Scroller](https://github.com/wangdahoo/vue-scroller) is a foundational component of [Vonic](https://github.com/wangdahoo/vonic) UI.
In purpose of smooth scrolling, pull to refresh and infinite loading.

> For vue 1.0, please refer to branch v1.
## [Demo](https://wangdahoo.github.io/vue-scroller/)
## Demo

[https://wangdahoo.github.io/vue-scroller/](https://wangdahoo.github.io/vue-scroller/)

## How to use

```html
<div id="app">
<scroller
:on-refresh="refresh"
:on-infinite="infinite"
ref="my_scroller">
<!-- content goes here -->
</scroller>
</div>
<scroller
:on-refresh="refresh"
:on-infinite="infinite">
<!-- content goes here -->
</scroller>
```

[Live Code](https://jsfiddle.net/wangdahoo/cpjfr096/)
[Live Code on JsFiddle](https://jsfiddle.net/wangdahoo/cpjfr096/)

## Webpack project by vue-cli

Expand All @@ -31,6 +30,7 @@ https://github.com/wangdahoo/vue-scroller-demo
#### Scroller instance methods:

- `resize()` resize scroller content
> Deprecated, casuse the scroller's content resizes self automatically.
- `triggerPullToRefresh()` start pull-to-refresh manually
- `finishPullToRefresh()` stop pull-to-refresh
- `finishInfinite(isNoMoreData :Boolean)` stop infinite-loading
Expand Down
37 changes: 16 additions & 21 deletions dist/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<script src="https://unpkg.com/vue@2.1/dist/vue.min.js"></script>
<script src="https://unpkg.com/vue@2.2.6/dist/vue.min.js"></script>
<script src="../vue-scroller.min.js"></script>
<title>Vue Scroller</title>
<style>
Expand Down Expand Up @@ -57,7 +57,7 @@ <h1 class="title">Refresh & Infinite</h1>
</div>
<scroller :on-refresh="refresh"
:on-infinite="infinite"
ref="my_scroller" style="padding-top: 44px;">
style="padding-top: 44px;">
<div v-for="(item, index) in items" class="row" :class="{'grey-bg': index % 2 == 0}">
{{ item }}
</div>
Expand All @@ -77,35 +77,30 @@ <h1 class="title">Refresh & Infinite</h1>
}
this.top = 1;
this.bottom = 20;

setTimeout(() => {
this.$refs.my_scroller.resize();
})
},

methods: {
refresh: function () {
setTimeout(() => {
var start = this.top - 1
refresh: function (done) {
var self = this
setTimeout(function () {
var start = self.top - 1
for (var i = start; i > start - 10; i--) {
this.items.splice(0, 0, i + ' - keep walking, be 2 with you.');
self.items.splice(0, 0, i + ' - keep walking, be 2 with you.');
}
this.top = this.top - 10;
this.$refs.my_scroller.finishPullToRefresh();
self.top = self.top - 10;
done();
}, 1500)
},

infinite: function () {
setTimeout(() => {
var start = this.bottom + 1;
infinite: function (done) {
var self = this
setTimeout(function () {
var start = self.bottom + 1;
for (var i = start; i < start + 10; i++) {
this.items.push(i + ' - keep walking, be 2 with you.');
self.items.push(i + ' - keep walking, be 2 with you.');
}
this.bottom = this.bottom + 10;

setTimeout(() => {
this.$refs.my_scroller.finishInfinite();
})
self.bottom = self.bottom + 10;
done();
}, 1500)
}
}
Expand Down
6 changes: 3 additions & 3 deletions dist/vue-scroller.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-scroller.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-scroller",
"version": "2.2.0-beta.1",
"version": "2.2.0",
"description": "Vue component for smooth scrolling, pull to refresh & infinite loading.",
"main": "dist/vue-scroller.min.js",
"author": "wangdahoo <157195705@qq.com>",
Expand Down

0 comments on commit 66588b3

Please sign in to comment.