Infiniteloading 无限加载
APP
PC
适用于显示同类的长列表数据类型,滚动自动加载列表。
引入方式
数字生活小程序工程中,不需要 import,直接使用组件标签即可。
import Infiniteloading from '@21cnfe/vui' Vue.component('Infiniteloading', Infiniteloading)
|
代码演示
Infiniteloading 无限加载
infiniteloadings
示例链接
示例源码
二维码
扫二维码查看演示效果

基本用法
<Infiniteloading @loadmore="onInfinite" :is-show-mod="true" :has-more="isHasMore" :is-loading="isLoading" :threshold="200"> <div class="list" v-for="(item, index) of data" :key="item">测试数据{{ index + 1 }}</div> </Infiniteloading>
|
export default { data() { return { data: new Array(30), page: 2, num: 30, isHasMore: true, isLoading: false, isErr: false, timer: null }; }, methods: { onInfinite () { this.isLoading = true; this.timer = setTimeout(() => { if (this.page <= 5) { this.data = new Array(this.num * this.page); this.page = this.page + 1; } else { this.isHasMore = false; } this.isLoading = false; }, 100); } }, destroyed() { clearTimeout(this.timer); } };
|
API
属性 |
说明 |
类型 |
默认值 |
has-more |
是否还有更多数据 |
Boolean |
'true' |
is-show-mod |
是否展示懒加载模块内容,一般适用于选项卡切换 |
Boolean |
'false' |
is-loading |
是否加载中 |
Boolean |
'false' |
threshold |
距离底部多远加载 |
Number |
200 |
Events
事件名称 |
说明 |
回调参数 |
loadmore |
继续加载的回调函数 |
-- |