All Projects → staticdeng → vuejs-loadmore

staticdeng / vuejs-loadmore

Licence: MIT license
A pull-down refresh and pull-up loadmore scroll component for Vue.js. Vue上拉加载下拉刷新组件

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects
HTML
75241 projects

Projects that are alternatives of or similar to vuejs-loadmore

Svelte Infinite Scroll
Infinite Scroll Component to Svelte
Stars: ✭ 102 (+64.52%)
Mutual labels:  infinite-scroll, scroll, infinite
Infinite Ajax Scroll
Turn your existing pagination into infinite scrolling pages with ease
Stars: ✭ 804 (+1196.77%)
Mutual labels:  infinite-scroll, scroll, infinite
ng-mat-select-infinite-scroll
Infinite Scroll directive for angular material select component
Stars: ✭ 39 (-37.1%)
Mutual labels:  infinite-scroll, scroll, infinite
Infinitescroll
Infinite Scroll (Endless Scrolling) for RecyclerView in Android
Stars: ✭ 183 (+195.16%)
Mutual labels:  infinite-scroll, scroll, infinite
react-infinite-scroll-list
Manage infinite list with the IntersectionObserver API
Stars: ✭ 20 (-67.74%)
Mutual labels:  infinite-scroll, scroll, infinite
tulip-scroll
📜 多场景的下拉组件和更多,https://artiely.gitee.io/scroll-docs/
Stars: ✭ 44 (-29.03%)
Mutual labels:  infinite-scroll, vue-scroller, vue-scroll
Endless
🛣 A lightweight endless pageControl based on CAShapeLayers and UICollectionView
Stars: ✭ 19 (-69.35%)
Mutual labels:  infinite-scroll, infinite
Loopingviewpager
A ViewPager and PagerAdapter combination that support auto scroll, infinite loop and page indicators.
Stars: ✭ 310 (+400%)
Mutual labels:  infinite-scroll, infinite
Vue Mugen Scroll
Infinite scroll component for Vue.js 2
Stars: ✭ 532 (+758.06%)
Mutual labels:  infinite-scroll, scroll
Rsdayflow
iOS 7+ Calendar (Date Picker) with Infinite Scrolling.
Stars: ✭ 843 (+1259.68%)
Mutual labels:  infinite-scroll, scroll
Ngx Infinite Scroll
Infinite Scroll Directive for Angular
Stars: ✭ 1,024 (+1551.61%)
Mutual labels:  infinite-scroll, scroll
Vue List Scroller
Simple and easy to use Vue.js component for efficient rendering large lists
Stars: ✭ 65 (+4.84%)
Mutual labels:  infinite-scroll, scroll
Ngx Ui Scroll
Infinite/virtual scroll for Angular
Stars: ✭ 145 (+133.87%)
Mutual labels:  infinite-scroll, scroll
React Infinite Calendar
✨ Infinite scrolling date-picker built with React, with localization, range selection, themes, keyboard support, and more.
Stars: ✭ 3,828 (+6074.19%)
Mutual labels:  infinite-scroll, infinite
angular2-infinite-scroll
Infinite Scroll Directive For Angular (version 2 up to 2.3.1)
Stars: ✭ 16 (-74.19%)
Mutual labels:  infinite-scroll, scroll
scrollbox
A lightweight jQuery custom scrollbar plugin, that triggers event when reached the defined point.
Stars: ✭ 15 (-75.81%)
Mutual labels:  infinite-scroll, scroll
uni-z-paging
【uni-app自动分页器】超简单!仅需两步轻松完成完整分页逻辑(下拉刷新、上拉加载更多),分页全自动处理。支持自定义加载更多的文字或整个view,自定义下拉刷新样式,自动管理空数据view等。
Stars: ✭ 91 (+46.77%)
Mutual labels:  refresh, pull-refresh
Listloading
listloading是一个移动端的上拉、下拉加载更多的组件。主要依赖于iscroll.js v5.1.2基础上开发的组件,基础库可以使用jquery.js或者zepto.js操作dom节点,目前我是使用了zepto.js作为基础库操作dom,以jquery插件的形式存在。如果不想以插件方式使用,则只需要把listloading直接移植你需要的库里面就ok啦。listloading主要针对移动端而生,在使用浏览器自带滚动,用户体验很不友好,与Android和ios差别甚远,所以选择iscroll.js,它实现方式是使用css3动画translate 3D 转换来实现滚动效果,transform属性使用硬件加速,性能方法得到很大提高。 https://gtdalp.github.io/widget/listloading/demos/listloading.html
Stars: ✭ 169 (+172.58%)
Mutual labels:  scroll, refresh
Pull To Refresh
ESPullToRefresh is developed and maintained by Vincent Li. If you have any questions or issues in using ESPullToRefresh, welcome to issue. If you want to contribute to ESPullToRefresh, Please submit Pull Request, I will deal with it as soon as possible.
Stars: ✭ 1,591 (+2466.13%)
Mutual labels:  infinite-scroll, refresh
Vue Scroller
Scroller Component for Vue.js
Stars: ✭ 1,775 (+2762.9%)
Mutual labels:  infinite-scroll, vue-scroller

vuejs-loadmore

Npm Version Build Status

NPM

一个Vue.js 的下拉刷新和上拉加载组件。

通过提供简单的api易于使用。与其他组件库不同,它使用浏览器本身而不是js来作滚动容器,因此它的代码量更小,但不损失用户体验。

中文 | English

预览

在线demo

也可以扫描以下二维码访问演示:

安装 & 使用

安装 npm 包

# npm
npm install vuejs-loadmore --save

全局导入

import Vue from 'vue';
import VueLoadmore from 'vuejs-loadmore';

Vue.use(VueLoadmore);

国际化支持

支持中文 zh-CN 和英文 en-US, 默认为 zh-CN。

import VueLoadmore from 'vuejs-loadmore';

Vue.use(VueLoadmore, {
  lang: 'en-US'
})

你也可以使用 locale.use() 指定语言。

import VueLoadmore, { locale } from 'vuejs-loadmore';

Vue.use(VueLoadmore);
locale.use('en-US');

用法

基础用法

<vue-loadmore 
  :on-refresh="onRefresh" 
  :on-loadmore="onLoad"
  :finished="finished">
  <div v-for="(item, i) of list" :key="i"></div>
</vue-loadmore>

on-refreshon-loadmore 会在下拉刷新或滚动到底部时触发,需要在处理完数据请求后执行回调函数 done()

如果你不需要刷新,只需要不绑定on-refresh

当数据请求完成后,你可以将finished的数据改为true,这样就会显示没有更多了

export default {
  data() {
    return {
      list: [],
      page: 1,
      pageSize: 10,
      finished: false
    };
  },
  mounted() {
    this.fetch();
  },
  methods: {
    onRefresh(done) {
      this.list = [];
      this.page = 1;
      this.finished = false;
      this.fetch();

      done();
    },

    onLoad(done) {
      if (this.page <= 10) {
        this.fetch();
      } else {
        // all data loaded
        this.finished = true;
      }
      done();
    },

    fetch() {
      for (let i = 0; i < this.pageSize; i++) {
        this.list.push(this.list.length + 1);
      }
      this.page++;
    }
  },
}

错误提示

<vue-loadmore 
  :on-loadmore="onLoad"
  :finished="finished"
  :error.sync="error">
  <div v-for="(item, i) of list" :key="i"></div>
</vue-loadmore>
export default {
  data() {
    return {
      list: [],
      finished: false,
      error: false,
    };
  },
  methods: {
    onLoad() {
      fetchSomeThing().catch(() => {
        this.error = true;
      });
    },
  },
};

API

Props

Attribute Description Type Default
on-refresh 顶部下拉触发 function -
pulling-text 下拉显示文本 string 下拉刷新
loosing-text 释放显示文本 string 释放刷新
refresh-text 正在刷新显示文本 string 正在刷新
success-text 刷新完成显示文本 string 刷新完成
show-success-text 是否显示success-text boolean true
pull-distance 触发正在刷新状态的距离 number | string 50
head-height 正在刷新显示区域的高度 number | string 50
animation-duration 下拉刷新动画持续时间 number | string 200
on-loadmore 滚动到底部触发 function -
immediate-check 是否立即触发数据加载;默认是,否的话则自己定义触发数据加载时机 boolean true
load-offset 当滚动条到底部的距离小于 load-offset 时,会发出 on-loadmore number | string 50
finished 数据是否加载完毕,改变为true,则会显示finished-text boolean false
error 数据是否加载错误,on-loadmore只有在点击错误文本时才会触发,需要sync修饰符 boolean false
loading-text 滚动到底部正在加载显示文本 string 正在加载
finished-text 滚动到底部加载完毕的显示文本 string 没有更多了
error-text 加载错误显示文本 string 请求失败,点击重新加载

方法

使用 ref 获取 List 实例并调用实例方法。

Name Description
checkScroll 检查当前的滚动位置,若已滚动至底部,则会触发 on-loadmore

例子

查看demo以快速了解如何使用此包。

git clone [email protected]:staticdeng/vuejs-loadmore.git
yarn install
yarn example:dev
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].