|
1 | 1 | # vue-infinite-loading
|
2 | 2 | An infinite loading/scroll plugin for Vue.js
|
| 3 | + |
| 4 | +## Install |
| 5 | +```bash |
| 6 | +npm install vue-infinite-loading --save |
| 7 | +``` |
| 8 | + |
| 9 | +## Import |
| 10 | + |
| 11 | +### ES6 |
| 12 | +```js |
| 13 | +import InfiniteLoading from 'vue-infinite-loading'; |
| 14 | + |
| 15 | +export default { |
| 16 | + components: { |
| 17 | + InfiniteLoading |
| 18 | + } |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +### Others |
| 23 | +The `InfiniteLoading` component will add to global `Vue` automatically, so you just need import it into your APP like this way: |
| 24 | +```html |
| 25 | +<script src="/path/to/vue-infinite-loading/dist/vue-infinite-loading.js"></script> |
| 26 | +``` |
| 27 | + |
| 28 | +## Usage |
| 29 | +Template: |
| 30 | +```html |
| 31 | +<body> |
| 32 | + <ul> |
| 33 | + <li v-for="item in list" v-text="item"></li> |
| 34 | + </ul> |
| 35 | + <infinite-loading :distance="distance" :on-infinite="onInfinite" v-if="loadedAllData"></infinite-loading> |
| 36 | +</body> |
| 37 | +``` |
| 38 | +### Props |
| 39 | + |
| 40 | +#### distance |
| 41 | +The distance from the footer of scroll parent that trigger loading function.(Unit: px) |
| 42 | +``` |
| 43 | +- type Number |
| 44 | +- required false |
| 45 | +- default 100 |
| 46 | +``` |
| 47 | + |
| 48 | +#### on-infinite |
| 49 | +The loading function. |
| 50 | +``` |
| 51 | +- type Function |
| 52 | +- required false |
| 53 | +``` |
| 54 | + |
| 55 | +## Development Setup |
| 56 | +```bash |
| 57 | +# install dependencies |
| 58 | +npm install |
| 59 | + |
| 60 | +# run dev-server |
| 61 | +npm run dev |
| 62 | +``` |
| 63 | + |
| 64 | +## Licence |
| 65 | +The MIT License (MIT) |
| 66 | + |
| 67 | +Copyright (c) 2016 PeachScript |
| 68 | + |
| 69 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 70 | +of this software and associated documentation files (the "Software"), to deal |
| 71 | +in the Software without restriction, including without limitation the rights |
| 72 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 73 | +copies of the Software, and to permit persons to whom the Software is |
| 74 | +furnished to do so, subject to the following conditions: |
| 75 | + |
| 76 | +The above copyright notice and this permission notice shall be included in all |
| 77 | +copies or substantial portions of the Software. |
| 78 | + |
| 79 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 80 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 81 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 82 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 83 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 84 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 85 | +SOFTWARE. |
0 commit comments